Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT does not find record
Message
From
22/11/2021 11:59:46
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01682735
Message ID:
01682772
Views:
33
Agreed, you don't want to do something that will introduce runtime errors for users. But that's why you can put basic TRY/CATCH statements around the query.

Maybe this is like fingernails on a chalkboard for me, but I don't like users getting the wrong row/incorrect data (nor do I like runtime errors either). Of the two, I'd actually consider bad data the worse of the two.

Like I said, if you've been doing it that way, I don't want to recommend a blind change - though at the very least, I'd suggest a check in your query if you get no results or more than 1 result - because the SELECT @Var = soemthing (by itelf) won't catch it.

Sorry, don't mean to sound dogmatic, but at the very least, I don't agree with SELECT @var = something, unless there are also safeguards in case multiple rows are detected.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform