user1193319
user1193319

Reputation: 11

SQL Server 2008 - Column defined at 600 varchar only captures 255 characters

Why is the length for my longcomment field (defined as varchar(600)) only up to 255 coming from an Excel spreadsheet? The length of the value in the spreadsheet is over 300 characters and the field in the table is defined at varchar(600). However, when I select on that field in SQL, it is truncating at 255.

Thanks!

Upvotes: 1

Views: 727

Answers (2)

F43G4N
F43G4N

Reputation: 175

In Microsoft SQL Server Management Studio, you can change the size by going to the Tools/Option menu and opening the Query Results branch on the tree control. Then under the Results to Text leaf is the the “Maximum number of characters in a column” value.

Upvotes: 1

JamieSee
JamieSee

Reputation: 13010

When an Excel files is parsed for import, only a certain number of rows are scanned to determine column size of the input. How you are importing the data makes a difference on what you need to change, basically you either need to override the detected column size or increase the number of rows scanned. Leave a comment with what import method you are using if you need additional help.

Upvotes: 3

Related Questions