PHP / PDO / MSSQL how to get error informations?

前端 未结 2 1268
情话喂你
情话喂你 2021-02-19 21:26

I\'ve done a lot of searching, but can\'t find anything about my issue. I\'m using PDO with Driver PDO_DBLIB to access a MS SQL database. I generally u

2条回答
  •  我寻月下人不归
    2021-02-19 22:03

    To find the error message:

    -- SQL 2005+
    select * from sys.messages where message_id = 241
    -- SQL 2000
    select * from sysmessages where error = 241
    

    It appears that PDO is removing the actual error message text for some reason, but since the documentation says that PDO_DBLIB is experimental, this may simply be a bug.

    You should also be aware that DBLIB has been deprecated by Microsoft since SQL 2005, so you should almost certainly use a different library for connecting to MSSQL.

提交回复
热议问题