Monday, July 25, 2005 10:33 AMWhen i use alter table alter column,i can lengthen the length of a column of nvarchar type.
But when i use the same way to shorten column length,it issue an error.
I know how to do this in Enterprise Manager,but not in Transact-SQL.
Monday, July 25, 2005 12:55 PMIf you make the change in Enterprise Manager but, innstead of saving your changes, click on the "Save Change Script" button on the toolbar and it will give you the T-SQL you need to make this change.
In this instance you will see that an ALTER COLUMN is not issued. Behind the scenes the table is actually dropped and recreated.
Monday, July 25, 2005 6:54 PMYou can use ALTER TABLE...ALTER COLUMN to reduce the length of the column as long as the data in your column will fit. See Books Online for more details. In general, you do not want to rely on the UI to make schema changes since it doesn't do the operation in the most efficient way and lot of cases it drops & recreates the table which is resource intensive.
Wednesday, July 27, 2005 8:15 AMThank