Oddly, I can do the following and get the info.
Create temporary table to hold output of sp_columns:
create table #client_columns(
TABLE_QUALIFIER sysname
,TABLE_OWNER sysname
,TABLE_NAME sysname
,COLUMN_NAME sysname
,DATA_TYPE smallint
,[TYPE_NAME] sysname
,[PRECISION] int
,[LENGTH] int
,SCALE smallint
,RADIX smallint
,NULLABLE smallint
,REMARKS varchar(254)
,COLUMN_DEF nvarchar(4000)
,SQL_DATA_TYPE smallint
,SQL_DATETIME_SUB smallint
,CHAR_OCTET_LENGTH int
,ORDINAL_POSITION int
,IS_NULLABLE varchar(254)
,SS_DATA_TYPE tinyint
)
Insert ouput into temp table:
insert into #client_columns
exec sp_columns @table_name = 'clients'
Then this works:
$result = mssql_query( "SELECT * FROM client_columns", $db);
while( $row = mssql_fetch_assoc( $result)) {
print_r( $row);
}
This never works:
$result = mssql_query( "exec sp_columns @table_name = 'clients'", $db);
while( $row = mssql_fetch_assoc( $result)) {
print_r( $row);
}
Thanks,
Eric Humphrey MCDBA, MCSA
Senior Developer
Bowman Systems, LLC
333 Texas Street, Suite 300
Shreveport, LA 71101
Phone: (318) 213-8780 x128
Fax : (318) 213-8784
Website: http://www.bowmansystems.com
IMPORTANT WARNING: This message is intended for the use of the person or
entity to which it is addressed and may contain information that is privileged
and confidential, the disclosure of which is governed by applicable law. If
the reader of this message is not the intended recipient, or the employee or
agent responsible to deliver it to the intended recipient, you are hereby
notified that any dissemination, distribution or copying of this information is
strictly prohibited. If you have received this message in error, please notify
the sender immediately and arrange for the return or destruction of these
documents.
Eric Humphrey wrote:
Trying to get column defaults using $db->describeTable() and
$array['COLUMN_DEF'] always comes back empty. Using php 5.2.5, ZF
1.0.3, SQL 2005. Everything looks OK in
library/Zend/Db/Adapter/Pdo/Mssql.php at quick glance. Added an
error_log statement to output $row at line 245 and it always shows
empty there as well. Everything else works, so it seems.