read mssql field type from php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thierry B.

    read mssql field type from php

    Hi,

    this question is 50% mssql and 50% php. To get field definitions and other
    informations for table 'myTable', I use with sql server:

    EXEC sp_help myTable

    The problem with php is this command returns several result sets, and
    informations about field types is not in the first one. If I query mssql
    from php and fetch result, I only get informations about the first one, and
    php completetly ignores the other one.

    Is there a mean to read other result sets, or is there another sql command
    that returns field definition?

    Thanks
    Thierry B.

    --
    Click below to answer / cliquez ci dessous pour me repondre


  • Thierry B.

    #2
    Re: read mssql field type from php

    "Thierry B." <thierry.bo@dum my.com> a écrit dans le message de
    news:c43p1r$6au $1@news-reader1.wanadoo .fr...[color=blue]
    > Hi,
    >
    > this question is 50% mssql and 50% php. To get field definitions and other
    > informations for table 'myTable', I use with sql server:
    >
    > EXEC sp_help myTable
    >
    > The problem with php is this command returns several result sets, and
    > informations about field types is not in the first one. If I query mssql
    > from php and fetch result, I only get informations about the first one,[/color]
    and[color=blue]
    > php completetly ignores the other one.
    >
    > Is there a mean to read other result sets, or is there another sql command
    > that returns field definition?
    >[/color]

    Sorry I just found,
    EXEC sp_columns @table_name = 'myTable'
    , or
    SELECT c.name, t.name
    FROM syscolumns c, systypes t, sysobjects o
    WHERE o.name = 'myTable' AND o.id = c.id AND c.xtype = t.xtype


    Thierry B.
    --
    Click below to answer / cliquez ci dessous pour me repondre


    Comment

    Working...