Hello, how can I by using Ado.net rename existing column in a table and changing a column's data type?
views:
156answers:
1
+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
2010-03-15 22:09:47
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
2010-03-15 22:37:34
Try this: ALTER TABLE MyTable ALTER COLUMN OldColumnName nvarchar(50) NOT NULL
Asad Butt
2010-03-15 22:53:18