Adding a new column between the existing column using T-sql

Self-innovator
Posted by Self-innovator under Sql Server category on | Points: 40 | Views : 1582
consider the existing table Persons
Columns:Name,Age and City
I want to add new column between Name and Age as Email through t-SQL
select Name,cast(null as varchar(50)) as 'Email',Age,City into tempPersons from Persons
drop table Persons//drop existing table
exec sp_rename 'tempPersons','Persons'//rename the table

Comments or Responses

Posted by: T.saravanan on: 12/26/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
Hi,

Kindly post your code inside the code tag.

Check this line... drop Persons//drop existing table

I think...drop table Persons


Login to post response