Home Check if a rule already exists
Reply: 0

Check if a rule already exists

user7594
1#
user7594 Published in September 19, 2018, 7:27 pm

When creating a rule for a user defined data type, how do I check if the rule already exists?

-- does rule exist?
CREATE RULE MyRule
AS @MyVar IN ('foo1', 'foo2')
share|improve this question
  • 2
    As an aside, rules are deprecated and will eventually be removed of SQL Server. You should use check constraints instead – Lamak Nov 13 '17 at 14:19
  • How about checking exists in sys.objects tables? – Edward N Nov 13 '17 at 14:20
  • @Lamak: Are u sure that I can use constraints for user defined types/table types? Look here: dba.stackexchange.com/questions/58348/… – Anil Bakirci Nov 13 '17 at 14:28
  • @Schwammkopf I don't really understand your question, but yes, check constraints can (I mean, whay else would the exist?) be used in user defined tables. The link you posted just shows wrong syntax being used – Lamak Nov 13 '17 at 14:31

1 Answer 1

active oldest votes
up vote 1 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.331774 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO