Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello Sir,
Please help me in my query kindly tell me the meaning

SQL
INSERT INTO Videos
OUTPUT inserted.*
VALUES(N'War of the Roses (The)', N'Dany de Vito', 0, N'R', 2001),
      (N'Memoirs of a Geisha', N'Rob Marshall', 1, N'PG-13', 2006),
      (N'Last Castle (The)', N'Rod Lurie', 1, N'', 2001),
      (N'Sneakers', N'Phil Alden Robinson', 1, N'PG-13', 2003);


What is the meaning of OUTPUT inserted.* ?

Thanks in Advance
Posted
Updated 7-Jan-12 1:21am
v2

1 solution

Read this page, it described it in details :

http://msdn.microsoft.com/en-us/library/ms177564.aspx[^]

OUTPUT will return affected rows by the last command which is an insert command here.

Here is another example :
http://www.kodyaz.com/articles/insert-into-two-tables-using-t-sql-output-clause.aspx[^]


Hope it helps.
 
Share this answer
 
Comments
Prashant Srivastava LKO 9-Jan-12 5:32am    
Thanks sir for the help, nice link
Amir Mahfoozi 9-Jan-12 5:34am    
You're welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900