Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you find the RULE associated to a column?

I have a SQL Database that has some Table and in that table there's a Column.

I'm using NHibernate to do an update to a record, when I get this exception saying I'm violating some RULE on the column.

I do some research to find out there's a RULE associated with that column in the database, but I have no idea how to find this rule, see what it does, etc.

Does anyone know how to show the rules for a column? Or just all the rules in the database, anything to get me heading in the right direction.

** EDIT **

The exact error message is:

A column insert or update conflicts with a rule imposed by a previous CREATE RULE statement. The statement was terminated. The conflict occurred in database '[MYDB]', table '[MYTABLE]', column '[MYCOLUMN]'.

like image 248
Joseph Avatar asked Jan 21 '23 08:01

Joseph


1 Answers

Do sp_help TableName. It will return a number of resultsets, one of which (the 7th one) shows the contraints on the table.

You can also inspect the other resultsets for not nullable columns, identity columns, etc.

like image 54
squillman Avatar answered Jan 22 '23 20:01

squillman