Since you can't get the values of parameters of running queries in SQL Server I was thinking of appending the parameter values to the query in the form of comments that would then be visible via sp_who2. For example If I have this query:
SELECT FirstName, LastName
FROM MyTable
WHERE FirstName = @P1
AND LastName = @P2
I would append the parameters to the query before submitting it so that it would be passed to the database looking like this:
SELECT FirstName, LastName
FROM MyTable
WHERE FirstName = @P1
AND LastName = @P2
/*
@P1 = John
@P2 = Doe
*/
I know that CFParam returns an array of the parameters passed in but that's only after the query result is returned. How can I go about doing this before the query is passed to the database?
Thanks!