odbc_columnprivileges

Lists columns and associated privileges for the given table

&reftitle.description; ``resource``false```odbc_columnprivileges` `resource` `odbc` ``string``null```catalog` `string` `schema` `string` `table` `string` `column`

Lists columns and associated privileges for the given table.

&reftitle.parameters;

`odbc`

- &odbc.connection.id;

`catalog`

- &odbc.parameter.catalog;

`schema`

- &odbc.parameter.schema; &odbc.parameter.search;

`table`

- The table name. &odbc.parameter.search;

`column`

- The column name. &odbc.parameter.search;

&reftitle.returnvalues;

Returns an ODBC result identifier&return.falseforfailure;. This result identifier can be used to fetch a list of columns and associated privileges.

The result set has the following columns:

- `TABLE_CAT`

- `TABLE_SCHEM`

- `TABLE_NAME`

- `COLUMN_NAME`

- `GRANTOR`

- `GRANTEE`

- `PRIVILEGE`

- `IS_GRANTABLE`

&odbc.result.driver-specific;

The result set is ordered by `TABLE_CAT`, `TABLE_SCHEM`, `TABLE_NAME`, `COLUMN_NAME` and `PRIVILEGE`.

&reftitle.examples;

### List Privileges for a Column

    <?php
    $conn = odbc_connect($dsn, $user, $pass);
    $privileges = odbc_columnprivileges($conn, 'TutorialDB', 'dbo', 'test', 'id');
    while (($row = odbc_fetch_array($privileges))) {
        print_r($row);
        break; // further rows omitted for brevity
    }
    ?>

&example.outputs.similar;

    Array
    (
        [TABLE_CAT] => TutorialDB
        [TABLE_SCHEM] => dbo
        [TABLE_NAME] => test
        [COLUMN_NAME] => id
        [GRANTOR] => dbo
        [GRANTEE] => dbo
        [PRIVILEGE] => INSERT
        [IS_GRANTABLE] => YES
    )