In Mysql, tinyint is signed by default, and the value range is -128 to 127. The unsigned attribute is to unsigned the number type. Unsigned tinyint is 0-255;
SQL Server supports bignt, Int, smallint, tinyint, the first three are signed, while tinyint is unsigned, and the value range is 0-255;
therefore, if the table structure is directly migrated in these two databases, Pay attention.
----------------------------
Use of zerofill:
CREATE TABLE `test` (
`u_id` INT(11) NOT NULL AUTO_INCREMENT,
` u_name` VARCHAR(50) DEFAULT NULL,
`tinyint1`TINYINT(1),
`tinyint2`TINYINT(2) ZEROFILL,
`tinyint3`TINYINT(3) ZEROFILL,
`tinyint4`TINYINT(4)ZEROFILL,
PRIMARY KEY (`u_id` )
) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
INSERT INTO test(u_name,tinyint1,tinyint2,tinyint3,tinyint4)VALUES('zerofill is to fill the default space with 0',6,6,6,6);
SELECT * FROM test;
![](http://dl2.iteye.com/upload/attachment/0121/0499/0d072b3e-e4dd-3e72-8dff-31444c9d1cd6.jpg)