|
alter table University add GID uniqueidentifier not null DEFAULT (newsequentialid())
-----------------------
CREATE PROCEDURE [Insert_test] @name as varchar(50), @id as uniqueidentifier OUTPUT AS BEGIN declare @returnid table (id uniqueidentifier)
INSERT INTO test( name ) output inserted.id into @returnid VALUES( @name )
select @id = r.id from @returnid r END GO
/* Test the Procedure */ declare @myid uniqueidentifier exec insert_test 'dummy', @myid output select @myid
---------------------------------------------------------------- DECLARE @MyDeletedRecords TABLE ( [ID] [bigint] , [RetID] [bigint] NULL, [DatePost] [nvarchar](50) NULL );
DELETE FROM Tb2 OUTPUT DELETED.* INTO @MyDeletedRecords WHERE [RetID] = 3
select * from @MyDeletedRecords
|