Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
mickers
Starting Member
2 Posts |
Posted - 2005-08-21 : 22:54:13
|
Hi,I am trying to pass a table to a stored proc and can't get it to work. Basically I want something like this to work: CREATE PROCEDURE dbo.ps_InsUpd @insertedTable table, @deletedTable table AS select * into #inserted from @insertedTable select * into #deleted from @deletedTableThe tables are the special tables inserted and deleted from the trigger for for insert, update, delete. Can you provide me the syntax to do this?Thanks,Michael-- 21st Century Technologies, Inc.http://www.21stsoft.com(303) 744-2178 Voice/Fax"Any sufficiently advanced technology is indistinguishable from magic."Arthur C. Clark, The Lost Worlds of 2001------------------------------------------- |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-08-21 : 23:10:48
|
sorry, you can't use tables as input parameters to a stored procedure. Anyway, once the trigger code has finished executing, the tables are out of scope. You can however create temp tables in the trigger itself and populate them based on the inserted and deleted tables. What are you trying to do?Be One with the OptimizerTG |
|
|
mickers
Starting Member
2 Posts |
Posted - 2005-08-23 : 20:32:40
|
I am auditing multiple tables. The audit is started in the insert, update, delete triggers for each of the tables we want to audit. Within each of these triggers I am calling this stored proc and want to pass the tables.The reason I am using the stored proc is so I can have one set of code that performs all of the aidit code, and if I want to change it, all changes can be made in one place.I have the code working as a trigger, but now I want to move it to the stored proc.-- 21st Century Technologies, Inc.http://www.21stsoft.com(303) 744-2178 Voice/Fax"Any sufficiently advanced technology is indistinguishable from magic."Arthur C. Clark, The Lost Worlds of 2001------------------------------------------- |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
|
|
|
|
|
|