Read rendered storeed procedure
Hello,
I have a stored procedure that someone else created using dynamic SQL. I'm just curious, is there a way vb.net (2008) can read the stored procedure the same way SQL Server interprets it?
So in other words I'd only see the actual select statement instead of all the concatentation and stuff associated with dynamic SQL
Thanks,
Strick
Re: Read rendered storeed procedure
Create an output parameter as type varchar(max), then set the output parameter equal to your query, and use .net code to read the output parameter
Re: Read rendered stored procedure
That's a really good idea. Thanks. One question though, this would run the sp though wouldn't it?
Strick
Re: Read rendered storeed procedure
Yes. If that's not what you want, you could add a debug input parameter using bit type, to determine if you want to return the SQL, or execute it.
Re: Read rendered storeed procedure
Excellent, thank you. That's the approach I'm going to take.
Strick
Re: Read rendered storeed procedure
Thread moved to 'Database Development' forum