











|  |
| Author |
check constraint creation
|
chris
Guest
Registered: Not Yet Location: Country: State: Certifications: Working on:
Total Posts: N/A
|
|
check constraint creation
I am trying to make a check constraint for a social security number:
alter table student
add constraint ssn_cons check(s_id like
"[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]")
but it keeps blowing up:
Server: Msg 1759, Level 16, State 1, Line 1
Invalid column '[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]' is
specified in a constraint or computed-column definition.
Server: Msg 1750, Level 16, State 1, Line 1
Could not create constraint. See previous errors.
--
Any ideas?
Thanks in advance.
Chris
Report this post to a moderator
|
|
10-17-02 04:23 PM
|
|
Wayne Snyder
Guest
Registered: Not Yet Location: Country: State: Certifications: Working on:
Total Posts: N/A
|
|
Re: check constraint creation
Simply use single quotes ' around the check constraint instead of double
quotes "
"chris" <chris@fin2000.com> wrote in message
news:eR9G9uedCHA.2504@tkmsftngp09...
> I am trying to make a check constraint for a social security number:
> alter table student
> add constraint ssn_cons check(s_id like
> "[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]")
>
> but it keeps blowing up:
>
> Server: Msg 1759, Level 16, State 1, Line 1
> Invalid column '[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]' is
> specified in a constraint or computed-column definition.
> Server: Msg 1750, Level 16, State 1, Line 1
> Could not create constraint. See previous errors.
> --
> Any ideas?
> Thanks in advance.
> Chris
>
>
Report this post to a moderator
|
|
10-17-02 04:23 PM
|
|
|
Forum Rules: Who Can Read The Forum? Any registered user or guest.
Who Can Post New Topics? Any registered user.
Who Can Post Replies? Any registered user.
Changes: Messages can be edited by their author.
Posts: HTML code is OFF. Smilies are ON. vB code is ON. [IMG] code is OFF. |
|
ExamNotes forum archive
|