Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alter Column Type from Char to Varchar in sql server

Tags:

sql

sql-server

I have a table with primary key 'username' and it's 'Char' , and I have to change it to varchar. There is a way to do that without lose the data? cause it's primary key and cascading all the other tables.

thanks.

like image 694
user2097810 Avatar asked Jan 08 '14 16:01

user2097810


1 Answers

ALTER TABLE table_name  -<-- Your Table Name
 ALTER COLUMN username  VARCHAR(50) NOT NULL
like image 95
M.Ali Avatar answered Oct 21 '22 03:10

M.Ali