Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Quickest way to see if a record exists
Message
 
 
To
17/09/2008 05:53:43
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
SQL Server:
SQL Server 6.5 and older
Miscellaneous
Thread ID:
01348134
Message ID:
01348137
Views:
24
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform