Hello,
I'd like to get the value of the id column for an object just after I've created it. But I don't want to run another query for that. My book for beginner (SQL Server 2008 for Dummies) says that there are 2 tables (inserted and deleted) that hold the last row(s) that have been inserted, updated, or deleted.
Unfortunately, only Triggers (says the book) can access those tables. But, if I use triggers, they will go off each time I "insert" a row even when I don't need them that functionality.
Can I obtain the same effect with a Store Procedure (without having to run a separate query?)
This is what I'm trying to do
CREATE PROCEDURE myProcedure
DECLARE @OrganizationName
@ColumnID OUTPUT
AS
INSERT INTO Organization (OrganizationName)
VALUES (@OrganizationName)
SET @ColumnID = (// Please, I need Help here ...)
Thanks for helping