Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column Length Check Contraint 1

Status
Not open for further replies.

Noonoo

Technical User
Jul 16, 2002
35
GB
Hello.

I'd like to constrain a table column to be either 11 numeric digits long or null. Though it's not strictly correct I can make the column Int to force numeric values but it's specifying Length within the constraint I'm having problems with. I've spent a while trying to achieve this but something about my contraint syntax is wrong. Can anyone help please.

This is what it feels like the costraint should be.
(LENGTH[column1] = 11) OR [column1] IS NULL)

I've tried putting LENGTH(column1) inside the left hand square brackets but that does'nt work either.



 
TRY:
Code:
(LEN (column1) = 11 OR column1 IS NULL)

[bandito] [blue]DBomrrsm[/blue] [bandito]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top