CREATE TABLE dbo.SampleTable
(ID INT, FirstCol VARCHAR(10), SecondCol DATETIME)
GO
ALTER TABLE dbo.SampleTable
ALTER COLUMN ID VARCHAR(100)
GO
ALTER TABLE dbo.SampleTable
ALTER COLUMN FirstCol VARCHAR(100)
GO
ALTER TABLE dbo.SampleTable
ALTER COLUMN SecondCol VARCHAR(100)
GOIn our example, it was possible to change the data types easily. If you face any errors, as per your error, you will have to adjust your business logic.
When running the last SP, you will note that you have successfully converted all the datatypes to another datatypeRakesh walia
No comments:
Post a Comment