Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can constraint include column value?
Message
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01481419
Message ID:
01481431
Views:
15
>>>Hi,
>>>
>>>When setting up table unique constraint I wanted to have a column value as part of the expression but don't seem to see how to do it in SSMS. For example, say I want the constraint to be on column MyColumn1 plus MyColumn2='1'. Can this be done?
>>>
>>>TIA.
>>
>>There doesn't seem to be a way to do this in the design view. You need to do this in code - specify unique constraint on both columns.
>
>I will try the approach of Check constraint as Sergey suggested. Thank you.

If you want some calculations like you described, then you need to use a Check constraint. Check constraint you can design visually.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform