Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Quickest way to see if a record exists
Message
 
 
À
17/09/2008 05:53:43
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 6.5 and older
Divers
Thread ID:
01348134
Message ID:
01348137
Vues:
26
It depends where you need such info. In T-SQL you can use EXISTS operator, otherwise you can use 'TOP 1' clause and check for # of record returned (1/0)
- In SP/T-SQL
IF EXISTS (SELECT 1 from mytable where myid = @lcid)
...

-- From VFP
SELECT TOP 1 myid from mytable where myid = ?lcid
>what is the best/ quickest way to check if a record exists in a table? thats all I want to know, ie "select from mytable where myid =lcid " and myId is not a primary key
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform