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
 General SQL Server Forums
 New to SQL Server Programming
 any way to compress varchar?

Author  Topic 

smithas123
Starting Member

1 Post

Posted - 2011-11-27 : 02:01:26
I am not having much exp in SQL. I have a VB6 application wherein there is a field which takes data from SQL table.Previously, the field in SQL table was of length varchar(20), but now I need to update it with new values which have length 24.So, I need to altered the column to varchar(30).But now, my application shows only 20 characters as there is some logic in the application which takes only 20chars; but the thing is I cant make changes in the application.
Please tell me is there any way where we can compress the data and show or anything like that??
PLSSSSSSss plsssssssssss help mee ASAP.
thanks in advance..

vikki.seth
Yak Posting Veteran

66 Posts

Posted - 2011-11-27 : 04:48:34
if you try this command you will get below error.

ALTER TABLE test1 ALTER COLUMN col1 varchar(3)

Msg 8152, Level 16, State 14, Line 1
String or binary data would be truncated.
The statement has been terminated.

you wont able to lower the size. till you modify the exceeded data to its minimum.
if you try
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-11-27 : 08:07:34
This seems like an intractable problem. If I understood correctly, you have two pieces - your VB application and the SQL query that feeds data to the VB app. If you cannot change the VB application, no matter what you do on the SQL side, the VB app is going to discard anything longer than 20 characters. I don't see a way around it other than changing the VB app.
Go to Top of Page
   

- Advertisement -