SQL alter column datatype from nvarchar to int
alter-table, sql-server, type-conversion
Solution
You can try doing an alter table. If it fails do this:
- Create a new column that's an integer:
`ALTER TABLE tableName ADD newCol int;`
- Select the data from the old column into the new one:
`UPDATE tableName SET newCol = CAST(oldCol AS int)`;
- Drop the old column
Problem
Can the datatype of a field be changed to int from nvarchar?? ``` alter table employee alter column designation int ``` is this valid?? If not can it be done in some other way?? P.S: I am using `MS SQL Server`