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.

Changing Data Type of Column in SQL Server

As you can see, the column data type of the table has been changed.

Good luck to everyone in business and life.

224 Views

Yavuz Selim Kart

I try to explain what I know in software and database. I am still improving myself by doing research on many programming languages. Apart from these, I am also interested in Graphic Design and Wordpress. I also have knowledge about SEO and Social media management. In short, I am a determined person who likes to work hard.

You may also like...

Don`t copy text!