Link to home
Start Free TrialLog in
Avatar of crnghtz
crnghtz

asked on

Can SQL Server 2008 do this? Allow only specific values..

One of the great features I like about Intersystems Cache is the ability to only allow specific values for a column. For example, if I have an Integer type column, I can specify to only allow the following values:

1000
1001
1002
1003

That column would only allow those values. Is this possible with SQL Server 2008?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of David Todd
David Todd
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of crnghtz
crnghtz

ASKER

Here you go. I have a question for you. If I create a stored procedure, is there a Select Case (like in VB.Net) in TSQL that would allow me to do the same thing?

Select Case @InputValue
 Case "1000"
   Return "1000"
 Case "1001"
   Return "1001"
 Case "1002"
   Return "1002"
 Case "1003"
   Return "1003"
 Case Else
   Return "1000"
End Select
Hi,

No.

The case that is T-SQL is for use inside queries, not a control flow structure.

Cheers
  David

PS Thanks for the grade and the points
Avatar of crnghtz

ASKER

Thanks and you're welcome.