Microsoft
Software
Hardware
Network
Question : SQL Query question
I have two columns (ColA, ColB) in a table (Table1) that must fulfil
certain combination of values. How can I stop SQL query to execute if
the query tries to update or insert an invalid combination of values?
Example:
if Table1.ColA equals 'ABC' then Table1.ColB must be equal 'XYZ'.
An update query should fail similar to the check constraint and
the data remains as it is. An insert query should fail as well
and the table will not have an extra invalid record.
Answer : SQL Query question
Create a check constraint on the table, with the condition in the Check
Here's a sample
alter table products add constraint ck_product check (len(Name) > len(FamilyCode))
Random Solutions
how to load ipt_REDIRECT.ko
VBScript to check if a account exist then what memebership it has
Printer Migration from Windows 2003 to Windows 2008 R2
Additional Domian Controler having windows 2008
Oracle Fail Safe Setup
How to alter web page so Google Chrome will clear old data?
vbscript exit if file exists
Cannot boot into Windows 7 partition (Blinking cursor) after using Acronis Disk Director resize
Resize a live OS partition whilst running! - Windows 2008
Network Installation/Setup