Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NEED HELP IN DETERMINING BYTE COUNT OF FIELD CONTENTS

Status
Not open for further replies.

ceesql

Programmer
Jul 6, 2001
28
0
0
US
A stored procedure fails because the contents of a field exceed the maximum size.
The error is: -2147217833
"Microsoft ODBC SQL Server Driver SQL Server Column 'upc_code' of table 'THWG.DBO.X_SHIP_LINE' cannot accept 16 bytes (15 max).

Is there a SQL command that give one the ability to determine the size of the field contents? How do you use it?
 

I'm unclear as to what you really want to know. I hope this info is helpful. If not please clarify your question.

Both Access and SQL Server have a LEN function which can detetermine the length of a string or the data in a column.

Select Len(upc_code)
From THWG.DBO.X_SHIP_LINE

If Len('string value') > 15 Then

If you want to find the maximum length of a column in a SQL Server table you can query the Information_Schema.Columns view.

Select character_maximum_length
From 'THWG.information_schema.columns
Where table_name='X_SHIP_LINE'
And column_name='upc_code' Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Thank You! That was the command I needed. I was able to get to the bottom of the issue in the table.

Thanks again and Merry Xmas!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top