From: Behzad Sadeghi on
On Jul 26, 1:21 am, Erland Sommarskog <esq...(a)sommarskog.se> wrote:
> Behzad Sadeghi (behzad.sade...(a)gmail.com) writes:
> > Reading your answer, I realized I have another problem. Let's say I
> > run the stored procedure from within a T-SQL script, either using
> > FMTONLY or not. I will get a result set, either empty or not. Now, how
> > can I examine this result set to decipher its columnar structure from
> > within my T-SQL script? I know I can use "insert <myTable> exec
> ><myProc>", which will persist a table in my database, which I can then
> > examine using system catalog views. But for that, I already need to
> > know the structure of the result set. Is there a way to do this
> > (persist the result set to the database) without knowing its
> > structure. Again, I need to do all this from within T-SQL.
>
> I can only agree with Jeroen, don't try do this from T-SQL, unless
> you really love to hurt yourself. You can do it all in SQL Server if
> you insist, but then you should write your discovery routines in C# ort
> VB .Net. But it's probably better to have it it all in a client-side
> program.
>
> --
> Erland Sommarskog, SQL Server MVP, esq...(a)sommarskog.se
>
> Links for SQL Server Books Online:
> SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
> SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
> SQL 2000:http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Thank you, Erland.