Well I have a specific dynamic sql statement , which is made at run time. Now i execute this statement and want to catch the result of this dynamic sql inside a procedure and want this procedure to return that value to my form in VB. How can i move about ?
There's nothing wrong with building a SQL String dynamically but if you execute() the string in SQL Server I don't think you can return a local variable from inside the SQL string to the connection. Are you executing a SQL Server sp from a vb client or executing a SQL statement directly from a SQLServer OLE DB connection? JHall
Use sp_executesql to execute your dynamic query. You can return a value (output parameter) when you use this system stored procedure. See the following article.
Once again Terry gives an answer that allows me to simplify a number of my existing procedures. I have to genuflect every time I read one of your posts. Many thanks! (Again)
-John JHall
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.