Do you ever wish to be able to "describe" a table in MSSQL?

Pick Language to Auto Translate:
AR | BG | CA | CS | DA | DE | EL | ES | FI | FR | HI | HR | ID | IT | IW | JA | KO | LT | LV | NL | NO | PL | PT | RO | RU | SK | SR | SL | SV | TL | UK | VI | ZH | ZH-TW

It is not available in MSSQL but it can be done with the help of function and store procedure.

In this article, I will show you how it can be done.

First create a XML variable like this:

SELECT @xmlFldList = (select * from ftvDescribe('tSomeTable') for xml raw)

Then call the spDescribeSchema to describe the table.

declare @SchemaInText varchar(max) exec dbo.[spDescribeSchema] @xmlFldList, @SchemaInText output

Please see the actual code of these calls above in this How-To

Forums: