If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > "Limit to List" equivalent in SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-13-06, 16:22
uwannadance uwannadance is offline
Registered User
 
Join Date: Aug 2004
Posts: 4
"Limit to List" equivalent in SQL

In Access, I can limit field options to a list. What is the equivalent in SQL 2005?
Reply With Quote
  #2 (permalink)  
Old 11-13-06, 16:39
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
use a lookup table and enforce referential integrity.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #3 (permalink)  
Old 11-13-06, 17:05
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
well, if it's a limited set, with ~0 likelihood of needing to be updated, you can also use a CHECK constraint

for example
Code:
create table foo
( ...
, gender char(1) null check (coalesce(gender,'M') in ('M','F'))
 ... )
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On