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.
| Author |
Topic |
|
TJ
Posting Yak Master
201 Posts |
Posted - 2002-08-23 : 12:31:40
|
| I need to create a constraint on a table that does the following:If the column Dirstate does not = 'MN' then the value of the column Filstat must be between 1-5.I right clicked on the column name and am adding the constraint in the design table of Enterprise Manager. (SQL 7.0)I keep getting a syntax error when I try to save the following code:[code([filstat] >= 1 and [filstat] <= 5 or (dirstate like['MN]( filstat ="")))[/code]Will someone please tell me what I'm doing incorrectly.Thanks!Teresa |
|
|
joshb
Yak Posting Veteran
52 Posts |
Posted - 2002-08-23 : 12:47:25
|
| I think your constraint should look like this:[dirstate] = 'MN' or ([filestat] <= 5 and [filestat] >= 1) |
 |
|
|
TJ
Posting Yak Master
201 Posts |
Posted - 2002-08-23 : 12:50:07
|
quote: I think your constraint should look like this:[dirstate] = 'MN' or ([filestat] <= 5 and [filestat] >= 1)
Does this translate to:If the dirstate = 'MN' then filestat can equal anything?Thanks for responding!Teresa"Someday I'll know enough to help someone else!" |
 |
|
|
joshb
Yak Posting Veteran
52 Posts |
Posted - 2002-08-23 : 12:54:14
|
quote: Does this translate to: If the dirstate = 'MN' then filestat can equal anything?
It translates to if dirstate='MN' filstat can equal anything, else filstat must be in the range 1-5. Isn't this what you're looking for? |
 |
|
|
TJ
Posting Yak Master
201 Posts |
Posted - 2002-08-23 : 13:25:21
|
quote: It translates to if dirstate='MN' filstat can equal anything, else filstat must be in the range 1-5. Isn't this what you're looking for?
It sure is! I just wanted to be sure I understood the code. Thanks again! Teresa |
 |
|
|
|
|
|