How to modify and add column in SQL Server’s table with TSQL

sql2008

USE Arm_DB
Go
IF OBJECT_ID('TBL_Persons','U') IS NOT NULL
 DROP TABLE TBL_Persons

CREATE TABLE TBL_Persons
 (
   ID INT IDENTITY PRIMARY KEY
   ,NAME Char(50)
 )

GO

     ALTER TABLE TBL_Persons
     ADD Lname Nvarchar(70)
Go
    ALTER TABLE TBL_Persons
    ALTER COLUMN NAME NVARCHAR(50)
GO
    INSERT INTO TBL_Persons(Name,Lname)
     VALUES ('Arman','Nas')
GO
    SELECT * FROM TBL_Persons


Categories: SQL Server, SQL Server Development

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: