Thursday, April 3, 2014

Best way to Share Data Between Stored Procedure and trigger


thanks for your answer @david.


but one problem when my store proc will create a temp table with a name #user_data then another user who can create temp table with same name or another user may execute that same store proc as a result store proc will create a temp table with same name so then there will be a clash & problem.


so i want to create a table with unique name for each sql server session. so please guide me. thanks

just name the table appending session id to it


ie like



DECLARE @Sql varchar(1000)='CREATE TABLE #User_data_' + CAST(@@SPID AS varchar(10)) + ' (col1 int,....)'
EXEC (@sql)





Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment