Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create a check constraint
Message
 
 
À
28/11/2005 04:05:07
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Maintenance bases de données
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01072346
Message ID:
01072529
Vues:
17
Kurt,

SQL 2000 doesn't allow subqueries in a Check Constraints. You can either use UDF() or put the check in a trigger.


>We have an sql2000 server up and running. Now i want to add a check constraint to one of the tables. The table contains invoice information about our shops. The field that must be checked can have the null value but when the field is filled out the value must be unique.
>
>Knowing that i opened (via enterprise manager) the my table in designmode a added a check constraint with the following syntax :
>(0>SELECT COUNT(*) FROM pos_s_invoice WHERE (doc_no IS NOT NULL and pos_is <> 899)GROUP BY doc_no HAVING (COUNT(*) > 1)).
>
>When i try to save the check constraint i get a validation error without any specification. Can somebody tell me what is wrong ?
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform