State Fields Explicitly to Avoid Fetch Error in PHP

Technology/Database 2010/02/09 10:46

Reference: String returned to Output Parameter from Stored Procedure is truncated

In PHP scripts, calling stored procedures from MS-SQL is necessary depending on a web application. In this case, if you are using MSSQL driver for PHP instead of the MSSQL module provided as a default driver, the following error message is sometimes seen.

01004 - [Microsoft][SQL Native Client]String data, right truncation

This is caused because the SELECT query does not specify fields explicitly like:

  1: SELECT
  2:     *
  3:   FROM
  4:     dbo.TableName

In order to avoid this error, just state field name explicitly like:

  1: SELECT
  2:     Field1,
  3:     Field2
  4:   FROM
  5:     dbo.TableName

Then, the error message above will no longer come out.

  1. 쟈스틴의 생각

    Tracked from justinsays' me2DAY 2010/02/09 10:54

    스토어드 프로시저 콜할 때 에러 피하기 State Fields Explicitly to Avoid Fetch Error in PHP http://ur.ly/43bl

트랙백 주소 :: http://justinchronicles.net/75/trackback/
옵션
댓글 달기