|
INTERVIEW QUESTIONS
DATABASE
MS SQL SERVER
DETAILS
Question: What Happens If an Integer Is Too Big for INT Date Type?
Answer: If you are entering an INT data type literal with representing an integer value too big for INT data type to store, the SQL Server will give you an arithmetic overflow error. The same error will happen on BIGINT, INT, SMALLINT, and TINYINT data types. Remember that INT data types uses 4 bytes to an integer value between -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647). The tutorial exercise below gives an example of arithmetic overflow errors.
-- INT value in the range DECLARE @x INT; SET @x = 2147483647; SELECT @x; GO 2147483647
-- INT value overflow DECLARE @x INT; SET @x = 2147483648; Msg 8115, Level 16, State 2, Line 2 Arithmetic overflow error converting expression to data type int.
|
|
|
Category |
MS SQL Server Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7872 users |
Added on |
9/23/2014 |
Views |
65947 |
Rate it! |
|
|
Question:
What Happens If an Integer Is Too Big for INT Date Type?
Answer:
If you are entering an INT data type literal with representing an integer value too big for INT data type to store, the SQL Server will give you an arithmetic overflow error. The same error will happen on BIGINT, INT, SMALLINT, and TINYINT data types. Remember that INT data types uses 4 bytes to an integer value between -2^31 (-2,147,483,648) to 2^31-1 (2,147,483,647). The tutorial exercise below gives an example of arithmetic overflow errors.
-- INT value in the range DECLARE @x INT; SET @x = 2147483647; SELECT @x; GO 2147483647
-- INT value overflow DECLARE @x INT; SET @x = 2147483648; Msg 8115, Level 16, State 2, Line 2 Arithmetic overflow error converting expression to data type int. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What Are Out-of-Range Errors with Date and Time Literals?
|
View Answer
|
|
What Happens If Time-Only Values Are Provided as Date and Time Literals?
|
View Answer
|
|
What Happens If Date-Only Values Are Provided as Date and Time Literals?
|
View Answer
|
|
Why I Can Not Enter 0.001 Second in Date and Time Literals in MS SQL Server?
|
View Answer
|
|
How To Enter Date and Time Literals in MS SQL Server?
|
View Answer
|
|
How To Enter Binary String Literals in MS SQL Server?
|
View Answer
|
|
How To Enter Unicode Character String Literals in MS SQL Server?
|
View Answer
|
|
How Fixed Length Strings Are Truncated and Padded?
|
View Answer
|
|
How To Find Out What Is the Default Collation in a Database?
|
View Answer
|
|
What Happens If Strings Are Casted into Wrong Code Pages in MS SQL Server?
|
View Answer
|
|
How To Specify the Collation for a Character Data Type in MS SQL Server?
|
View Answer
|
|
What Is a Collation in MS SQL Server?
|
View Answer
|
|
How To Write Character String Constants or Literals in MS SQL Server?
|
View Answer
|
|
What Is a Constant or Literal in MS SQL Server?
|
View Answer
|
|
What Are the Differences between DECIMAL and FLOAT in MS SQL Server?
|
View Answer
|
|
What Are the Differences between CHAR and VARCHAR in MS SQL Server?
|
View Answer
|
|
What Are the Differences between CHAR and NCHAR in MS SQL Server?
|
View Answer
|
|
What Are Binary String Data Types in MS SQL Server?
|
View Answer
|
|
What Are Unicode Character String Data Types in MS SQL Server?
|
View Answer
|
|
What Are Character String Data Types in MS SQL Server?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All MS SQL Server Interview Questions & Answers - Exam Mode /
Learning Mode
|