Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 constraint for an empty string

Author  Topic 

paulv2005
Starting Member

1 Post

Posted - 2007-07-27 : 05:36:59
How do I prevent a column having empty strings entered into it. I want to allow
nulls but not allow empty strings.

Paul

Kristen
Test

22859 Posts

Posted - 2007-07-27 : 05:39:21
We use a trigger to "silently" convert empty-string to NULL - rather than using a Constraint to enforce non-empty.

Kristen
Go to Top of Page

Koji Matsumura
Posting Yak Master

141 Posts

Posted - 2007-07-27 : 05:42:15
Use CHECK Constraints.
CHECK (ColumnName != '')
Go to Top of Page
   

- Advertisement -