B
BobRoyAce
If I run a query in SQL Management studio, I can set options such that
I can see the results returned by the query as text at the bottom of
the form. Sample results could be as follows:
column headers, followed by blank line, followed by "(0 row(s)
affected)" for SELECT query that returns nothing
column headers, followed by rows of data for records that match
SELECT criteria
"(0 row(s) affected)" for UPDATE query that affects nothing
etc.
What I want to be able to do is have a Function that will run a query,
based on passed in SQL, and then return a String containing the
results, as described above. I know how to execute a query, just
wondering if there's an easy way to get the results as a string.
The DB that I am running against is SQL Server 2005.
I can see the results returned by the query as text at the bottom of
the form. Sample results could be as follows:
column headers, followed by blank line, followed by "(0 row(s)
affected)" for SELECT query that returns nothing
column headers, followed by rows of data for records that match
SELECT criteria
"(0 row(s) affected)" for UPDATE query that affects nothing
etc.
What I want to be able to do is have a Function that will run a query,
based on passed in SQL, and then return a String containing the
results, as described above. I know how to execute a query, just
wondering if there's an easy way to get the results as a string.
The DB that I am running against is SQL Server 2005.