Just in Chronicles

Life as a Voyage

State Fields Explicitly to Avoid Fetch Error in PHP

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:

SELECT * FROM dbo.TableName

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

SELECT Field1, Field2 FROM dbo.TableName

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

Advertisements

Written by Justin Yoo

08/02/2010 at 23:46

One Response

Subscribe to comments with RSS.

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

    justinsays' me2DAY

    08/02/2010 at 23:54


Comments are closed.