Get Specific Info From SQL Error Message 547

后端 未结 2 915
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-07 05:05

How do I correctly extract specific info from an sql error message number 547?

Info Required:

  • Table Name
  • Constraint Name
  • Column Name
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-07 05:49

    There is no straight forward way of getting these pieces of information separately.

    It all gets concatenated into the error message.

    You can use select * from sys.messages where message_id=547 to see the various different language formats of the message that you would need to deal with in order to extract the constituent parts then perhaps use regular expressions with capturing groups based around this information.

提交回复
热议问题