Changing Data Type of Column in SQL Server
Hello to everyone,
In this article, I will give information about how to change the data type of a column in SQL Server.
In SQL Server you may need to change the data type of a column in some cases.
You can do this easily using the code below.
--Creating a sample database
CREATE TABLE ExampleDBTable(
ID INT PRIMARY KEY IDENTITY(1,1),
NAME NVARCHAR(100)
)
--Changing Data Type of Column in SQL Server
ALTER TABLE ExampleDBTable
ALTER COLUMN NAME NVARCHAR(200)
When you run the code, you will get a result like the one below.
As you can see, the column data type of the table has been changed.
Good luck to everyone in business and life.