views:

156

answers:

1

Hello, how can I by using Ado.net rename existing column in a table and changing a column's data type?

+2  A: 

You can call stored procedure for that, as follows

EXEC sp_rename 'MyTable.OldColumnName', 'NewColumnName'

see section: Renaming a Column in this Article

Asad Butt
and you also agree with me for changing column data Type use something like this? ALTER TABLE tableName ALTER COLUMN colName nvarchar(50).for example: a have column with nvarchar(50) data type? and it's filled with values, how to me convert this column data type to int? firstly i must remove all data from this column?
loviji
Try this: ALTER TABLE MyTable ALTER COLUMN OldColumnName nvarchar(50) NOT NULL
Asad Butt