Title: RE: SQL check constraint

Taking a guess...

columnName VARCHAR(25) NOT NULL
CONSTRAINT columnName_chk
CHECK
(CHARINDEX(' ', columnName) = 0)

...so that was just a guess.  It might work.

Maybe if you know the column will only take alphaNumerics, maybe something with RegExs: columnName Like [0-9][a-z].

I might be totally wrong??

Robert Hinojosa
Senior WebDeveloper
Senior Principal Consultant
[EMAIL PROTECTED]
www.hencie.com
972-671-0011 ext.284 


        :-----Original Message-----
        :From: Jeremy Ridout [mailto:[EMAIL PROTECTED]]
        :Sent: Monday, April 23, 2001 10:02 AM
        :To: [EMAIL PROTECTED]
        :Subject: OT: SQL check constraint
        :
        :
        :Using SQL Server 7, how would you write a check
        :constraint for a varchar(25)
        :column that would disallow spaces? (I'm guessing it
        :would be a check
        :constraint, if there is a better way, I'm all ears.)
        :
        :In other words, I don't want any spaces in the
        :inserted text. What is the
        :best way to validate this from the database side?
        :
        :Thanks in advance for your help!
        :
        :Jeremy
        :
        :-------------------------------------------------------
        :------------------
        :This email server is running an evaluation copy of the
        :MailShield anti-
        :spam software. Please contact your email administrator
        :if you have any
        :questions about this message. MailShield product info:
        :www.mailshield.com
        :
        :-----------------------------------------------
        :To post, send email to [EMAIL PROTECTED]
        :To subscribe / unsubscribe: http://www.dfwcfug.org
        :

Reply via email to