Sql To Xml

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rupal kankaney
    New Member
    • Aug 2007
    • 2

    Sql To Xml

    Hi All
    i am facing problem in convertin sql to xml
    Query
    [code=sql]
    select top 1 C.TABLE_NAME ,C.COLUMN_NAME, C.DATA_TYPE,C.I S_NULLABLE,TC.C ONSTRAINT_TYPE ,isnull(C.chara cter_maximum_le ngth ,isnull (C.character_oc tet_length,C.nu meric_precision ))as LENGTH
    FROM INFORMATION_SCH EMA.COLUMNS C
    left outer JOIN INFORMATION_SCH EMA.TABLE_CONST RAINTS TC
    ON C.TABLE_NAME = TC.TABLE_NAME
    WHERE C.TABLE_CATALOG = 'D1Master'
    for XML auto ,elements[/code]

    o/p[code=xml]
    <C><TABLE_NAME> v_img_work_d1_b ranch</TABLE_NAME><COL UMN_NAME>Active _Flg</COLUMN_NAME><DA TA_TYPE>int</DATA_TYPE><IS_N ULLABLE>YES</IS_NULLABLE><TC ><LENGTH>10</LENGTH></TC></C>[/code]

    ***But the o/p which i need should be like table name and column name should be ended in last not just like above query

    Thanks
    Rupal
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, Rupal. Welcome to TSDN!

    Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

    What do you want your code to do? Give an example.
    What is your code doing that you don't want it to do? Give an example.
    What is your code *not* doing that it is supposed to? Give an example.

    Comment

    Working...