By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,090 Members | 980 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,090 IT Pros & Developers. It's quick & easy.

Add a cloumn with a row source

P: n/a
I I've added a column to a table using a sql statement IE "ALTER TABLE
sometable ADD COLUMN Direction" Now I would like to limit the valid
entries for the field to North;East;South;West; How do I do this with
a SQL statement?

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

If you're using ANSI-92 SQL (Access 2002 & above and SQL Server) you can
use this DDL statement:

ALTER TABLE table_name ADD CONSTRAINT CK_Direction CHECK (Direction In
('North', 'South', 'East', 'West'))

Otherwise, you can open the table in design view and set the column
Direction's Validation Rule property to:

In ('North', 'South', 'East', 'West')

Interestingly, when using the ALTER TABLE statement, the Check
expression doesn't appear in the table's Validation Rule property.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQfbcDIechKqOuFEgEQK6UgCfYcznLNNgi3TvHbumw0+bMb kZkQIAoLMp
PTZ8ZMymYsZduqzE8kYi407Y
=D9XG
-----END PGP SIGNATURE-----
adolph wrote:
I I've added a column to a table using a sql statement IE "ALTER TABLE
sometable ADD COLUMN Direction" Now I would like to limit the valid
entries for the field to North;East;South;West; How do I do this with
a SQL statement?

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.