SQL Facts

varchar(n) range is 1 to 8000 character

nvarchar(n) range is 1 to 4000 character
/************************ add coloumn in table at particular position in sql server 2005****************/

alter table <tablename> add column <column name> datatype after <column name>
/**************************using of Output Clouse in sql***********************************/
CREATE TABLE dbo.Books

(

BookID int NOT NULL PRIMARY KEY,

BookTitle nvarchar(50) NOT NULL,

ModifiedDate datetime NOT NULL

);

DECLARE @InsertOutput1 table

(

BookID int,

BookTitle nvarchar(50),

ModifiedDate datetime

);

INSERT INTO Books

OUTPUT INSERTED.*

INTO @InsertOutput1

VALUES(101, ‘One Hundred Years of Solitude’, GETDATE());
SELECT * FROM Books;

 

— view output row in @InsertOutput1 variable

SELECT * FROM @InsertOutput1;

Advertisements

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