April 1, 2004 at 5:50 am
hi,
i am looking for an way that i can read out in an procedure
the parameter from the caller, so that i can see was in the variable a and b ..
like this
create proc test(@a int, b char(10))
.....
declare give_param varchar(100)
set = "procedure test 2,'abcd'"
(that i want to write in a logfile...)
---
i think there should be a way that i can read out this string from the running process that handle this call,
but i dont know how i can read out
please help
April 2, 2004 at 3:26 am
If I understand you correctly, you could use
-- this is the calling procedure
create procedure test1
as
Declare @give_param varchar(100)
Declare @a int
Declare @b-2 char(10)
Set @a = 10
Set @b-2 = 'spam'
Exec test @give_param out, @a, @b-2
Print @give_param
GO
create proc test(@give_param varchar(100) OUT,@a int, @b-2 char(10))
AS
set @give_param = 'procedure test ' + Convert(varchar,@a) + ', ' + @b-2
GO
exec test1
yields the result
procedure test 10, spam
You can write the contents of @give_param to your log file in either procedure.
April 2, 2004 at 5:27 am
thank´s for answer
but i dont want to parse the variables directly
my idea for that, from the caller request (a webserver formular) the variables from the procedure test (@a,@b)
i want to read the given @a,@b via @@SPID from the generated process inline from the inputbuffer, i think like in enterprise manager. but i dont know if i can read this inline in the procedure ( the same @@spid)
if this works i can write that inputbuffer in a table or other file, maybe my procedure generate an raiserror if there is anything wrong with the @a or @b-2, so i can paste that error to my tabel or file,
i hope i can see with then what funny things people want to know from my db, and i also can see if a user what to see the same infomation more then one times in the same second....
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply