I use the following code to make a rule and use it for my PHONE column:

CREATE RULE phone_rule AS
@phone LIKE '([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'

The problem is :

When I run this code nothing add to my "Data Type" drop down box to set my PHONE column data type to my created rule (phone_rule).

What is the solution?

Recommended Answers

All 3 Replies

I don't know too much about Rule Objects but did you run

sp_bindrule to bind the rule to the your coluum.

Yeah I did it, but I got this error:

The data type or table column 'teacher.phone' does not exist or you do not have permission.

And of course the columns exists and I set the appropriate permission to it.

Im sure you are just missing something in the syntax,
unfortunately I have never used this object and since it is being deprecated by Micorsoft in future releases I doubt I ever will.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.