Reputation: 204746
I got a multi-use SQL table in my SQL Server 2008 database. It can store only 100 characters as value.
Now I want to store a value in it that has more than 100 characters. Is it possible to zip or compress a text with SQL Server functionality?
Upvotes: 2
Views: 418
Reputation: 754348
If your column is defined as VARCHAR(100)
, it can hold a maximum of 100 characters. There's no "magic" or "compression" that makes this go away.
Yes, SQL Server has text compression - to reduce the disk space used. But if the column is limited to 100 characters, it can store no more than 100 characters.
If you need more - you need to define a column with a larger capacity. There's no other solution.
It's very easy to change a column's datatype, too - so if you need to, you should be able to just issue a SQL statement like:
ALTER TABLE dbo.YourTable ALTER COLUMN YourColumn VARCHAR(150)
and now your column can store up to 150 characters. This is a non-destructive change, e.g. existing data will not be affected (not wiped out or deleted).
Upvotes: 2