sql server - Use PHP to set column description in MSSQL -


I am working on a web app which is using PHP and MSSQL. One of my requirements is to use field descriptions in MSSQL in the part of the web app.

I know that to add description to the stored prompt MSSQL:

  EXEC sp_addextendedproperty @name = n 'description', @value = 'description goes here', @ Level0type = N'Schema ', @ level0name =' schemaname ', @ level 1 type = N'Table', @ level1name = 'tablename', @ level2type = N'Column ', @ level2name =' columnname 'live  

I'm having trouble switching to PHP

I am trying to use mssql_init / bind / exec commands, but I am getting an error which I'm not sure how to troubleshoot.

PHP code:

  $ query = mssql_init ("sp_addextendedproperty", $ dblink); Mssql_bind ($ query, "@ name", "N'Description '", SQLVARCHAR); Mssql_bind ($ query, "@ value", $ _ post ['description'], SQLVARCHAR); Mssql_bind ($ query, "@ level0type", "N'Schema '", SQLVARCHAR); Mssql_bind ($ query, "@ level0name", "dbo", SQLVARCHAR); Mssql_bind ($ query, "@ level1type", "N'Table '", SQLVARCHAR); Mssql_bind ($ query, "@ level1name", $ _ post ['tableselect'], SQLVARCHAR); Mssql_bind ($ query, "@ level2type", "N'Column", SQLVARCHAR); Mssql_bind ($ query, "@ level1name", $ _ post ['COLUMN_NAME'], SQLVARCHAR); Mssql_execute ($ query)  

My error is:

  An invalid parameter or option was specified for the process 'sp_addextendedproperty' (seriously 16) < / Code> 

To fully troubleshoot this problem, I do not have enough information about the stored procedures can anyone help me?

Unless you only post your sample code, again @ level1name Instead, the second event should be @ level2name instead.


Comments