output-clause

Aliasing inserted and deleted virtual tables in a trigger

How do I alias the inserted and deleted virtual tables in a trigger in MSSQL 2005 so that I can use another set of inserted and deleted virtual tables from an OUTPUT clause later in the trigger? I need to alias these tables in a trigger as per http://msdn.microsoft.com/en-us/library/ms177564%28SQL.90%29.aspx. [Edit] I should have been...

OUTPUT clause for Stored Procedure vs Table-Valued Function

I'm studying for the MCTS 70-433 "Database Design" cert, and in the text that I'm studying, one of the self-tests has this question. You have a stored procedure named Get_NewProducts. You wish to insert the results of this stored procedure into the Production.Product table and output the INSERTED.* values using the OUTPUT ...

Output columns not in destination table?

SUMMARY: I need to use an OUTPUT clause on an INSERT statement to return columns which don't exist on the table into which I'm inserting. If I can avoid it, I don't want to add columns to the table to which I'm inserting. DETAILS: My FinishedDocument table has only one column. This is the table into which I'm inserting. FinishedDocum...

DELETE from two tables with one OUTPUT clause?

This deletes the document from the Document table and outputs information about the deleted document into the FinishedDocument table. DELETE FROM Document OUTPUT Deleted.DocumentId , Deleted.DocumentDescription INTO FinishedDocument WHERE DocumentId = @DocumentId I need to delete the document not just from the Document table, but ...