Stored Procedure Call (XML SChema Return)

Posts   
 
    
ftuttle
User
Posts: 40
Joined: 10-Dec-2006
# Posted on: 06-Dec-2008 02:56:39   

I have created a stored procedure that returns a table schema. There is one paramter passed in (the name of the table) and the SP returns the schema for that table:

Exec('Select * from ' + @TableName + ' FOR XML AUTO, XMLSCHEMA')

It appears that the "RetrievalProcedures" returns a data table. I will be getting back a long songle record (string).

Is the "RetrievalProcedures" the correct call for me to make to get the schema or is there is better suited method to use?

Thanks

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 06-Dec-2008 11:41:47   

It's impossible to determine how many rows are in the resultset, therefore the code can only assume there are more than 1 row, even if the row has a single value (as the # of columns is unknown too).

If you want to have a single value, consider using an output parameter.

Frans Bouma | Lead developer LLBLGen Pro