Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 varchar

Author  Topic 

sqlferns
Starting Member

8 Posts

Posted - 2008-07-15 : 18:09:17
I have a text data stream that gets parsed
to a 1000 character VARCHAR column. Most of the columns end up being 1000
characters. But, one is only 999 (not the last one). For some reason, the
last character is being truncated, it is a space. I haven't look at the 1000
character rows to see if they have 1 or more trailing spaces.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-15 : 18:11:45
What is your question?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

sqlferns
Starting Member

8 Posts

Posted - 2008-07-15 : 20:36:37
The 12th segment (1000 characters) is sent to the database as 1000 characters,
but the database only contains 999. The last space in the segment is trimmed.
This causes the schema to be invalid in this case.

So what could be the reason
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-07-15 : 20:46:29
I don't know, you haven't shown us any code or described your process so it's hard to provide any feedback.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-16 : 10:03:14
quote:
Originally posted by sqlferns

I have a text data stream that gets parsed
to a 1000 character VARCHAR column. Most of the columns end up being 1000
characters. But, one is only 999 (not the last one). For some reason, the
last character is being truncated, it is a space. I haven't look at the 1000
character rows to see if they have 1 or more trailing spaces.



Are you using some trimming functions or applying any other string functions while populating string values to table? Posting you current might help us.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-16 : 10:16:08
Use CHAR(1000) as datatype instead of VARCHAR(1000) which automatically trims trailing spaces, whereas CHAR keeps trailing spaces ( and even inserts spaces if missing!).



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -