June 6, 2002 at 10:29 pm
"myName" is a char(5). So the following generates an error under QA.
insert mytable (myName) values('asdfddfhvhkjhjkhkjhkjkjh')
Server: Msg 8152, Level 16, State 9, Line 1
String or binary data would be truncated.
The statement has been terminated.
Msg and Level I can find in sysmessages. But what is the significance of State and Line? I particular, Line 1 of what?
June 7, 2002 at 5:18 am
Excert From SQL BOL
quote:
Error Message FormatsAll of the Microsoft® SQL Server™ 2000 components can issue informational, warning, or error messages to applications. Most SQL Server messages returned to applications contain these parts:
Error number
A one-to-five-digit number that identifies the message. Error numbers for user-defined messages can contain more digits.
Description
A Unicode string that contains information about the condition that generated the message.
Severity level
A one- or two-digit number that indicates the severity of the error condition.
State
A one- to three-digit number with a maximum value of 127 that indicates to Microsoft support engineers and developers the location in the SQL Server code that generated the message:
Line number
A number within the batch or stored procedure that contains the statement that generated the message. Line number can also be within the text of the stored procedure that is being executed.
Line is the line number of the code depending the state of the execution process. A single string would be line 1.
However
INSERT
myTable
(myName)
VALUES
('asfsfsfsfsfsfssfsf')
will also generate line one as the whole query has to take place to generate the error. But if say you had
INSERT
myTable
(myName)
VALUES
('asfsfsfsfsfsfssfsf)
You would get
Server: Msg 105, Level 15, State 1, Line 5
Unclosed quotation mark before the character string 'asfsfsfsfsfsfssfsf)
'.
Which tells you if you have this item in the code multiple times where the problem exists.
Now as for state like it says this number is really for MS to diagnose a problem. I notice some things but have not found a consistant understanding of the code.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy