Programming in MS SQL Server 2012

Integer Data Type



Integer data type is used to stores Natural Number or Whole Number that can start with + positive or - negative sign. SQL Server is allocate 4 bytes memory to stores integer data value from -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647). The following example describes an Integer Data Type.

-- Example 74 --

 

DECLARE @ProductCode01 int

SET @ProductCode01 = 12345

PRINT @ProductCode01

 

DECLARE @ProductCode02 int

SET @ProductCode02 = 12345

SELECT @ProductCode02 AS [Product Code]

 

DECLARE @ProductCode03 int

SET @ProductCode03 = 12345

SELECT 'Product Code' = @ProductCode03


Query Output Screen



Note:

bigint data type range -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

int data type range -2,147,483,648 to 2,147,483,647

smallint data type range -32,768 to 32,767

tinyint data type range 0 to 255

* * * * *


Email Your Comment To AUTHOR