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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 constraints

Author  Topic 

ccrespo
Yak Posting Veteran

59 Posts

Posted - 2007-08-02 : 09:30:33
hi,
Is there any way to put a constraint on a field in a table, based on a select statement from another table? or if someone enters a value that is not in a select from another table then to raise an error?

sshelper
Posting Yak Master

216 Posts

Posted - 2007-08-02 : 09:39:47
Based on your description, you can use a foreign key constraint on your column. The Foreign Key constraint will make sure that whatever value is entered to the column will exist on the other table.

SQL Server Helper
http://www.sql-server-helper.com
Go to Top of Page
   

- Advertisement -