Identify ObjectName from SQL Statement

  • Hi all,

    I have a sql statement which have multiple table in Join.

    I want all the column along with corresponding object.

    Example

    Sql Statement

    -------------

    Select * from Table1, Table2 where Table1.id= Table2.id

    I need this

    ColumnName ObjectName

    Column1 Table1

    Column1 Table2

    Vijay

  • This was removed by the editor as SPAM

  • What about this:

    SELECT TABLE_NAME, COLUMN_NAME

    FROM INFORMATION_SCHEMA.COLUMNS

    WHERE TABLE_NAME IN 'Table1','Table2')

    [font="Verdana"]Markus Bohse[/font]

  • This was removed by the editor as SPAM

  • of course we have sysobjects but firstly understand my question, I have Sql Statement not Sql Object.

    Statement like "Select * from TableName"

    Vijay

  • vijay.s (12/28/2011)


    of course we have sysobjects but firstly understand my question, I have Sql Statement not Sql Object.

    Statement like "Select * from TableName"

    Vijay

    Not sure if this is what you want, but have you tried using FMTONLY ?

    SET FMTONLY ON

    Select * from TABLE1

    Select * from TABLE2

    SET FMTONLY OFF

    [font="Verdana"]Markus Bohse[/font]

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply