I want to change the datatype of a column in a table in sql server. I used the following statement:
ALTER TABLE dbo.tbltest
ALTER COLUMN ID uniqueidentifie
Note to people using Entity Framework:
Obviously, if you have a large database with complex relationships, dropping all relationships and ID columns, and re-adding them is a huge ordeal.
It's much easier to update the generated model (.edmx).
Yes, Visual Studio allows you to update the data type without complaining. In fact, when you save the .edmx file, the relationships will be validated; any fields that you may have missed will show up as errors.
After you're finished, you can regenerate the database from the model. Boom, done.