Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Find if a value is in a table
Message
 
 
À
18/08/2011 10:09:34
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01521232
Message ID:
01521233
Vues:
42
>Hi
>
>I want to find if a value is already in a table in SQL2005 and if it is I will raise an error .
>
>If not I add a record.
>
>I'm not sure what syntax to use to find if the value is already in the table.
>
>In Fox I would have used a SEEK
>
>
>Thanks
>
>
>Nick

IF you know which field to check, then
IF EXISTS (SELECT 1 FROM dbo.myTable WHERE Field = @Value)
   RAISERROR ...
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform