Technology/Database2010/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.

Posted by Justin

TRACKBACK http://justinchronicles.net/trackback/75 관련글 쓰기

  1. 쟈스틴의 생각  삭제

    2010/02/09 10:54TRACKBACK FROM justinsays' me2DAY

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

댓글을 달아 주세요