Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SELECT does not find record
Message
 
 
À
22/11/2021 11:59:46
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01682735
Message ID:
01682773
Vues:
25
There should be a warning message at the top of all my code (not only T-SQL, but VFP, C#, etc.). This warning should say:
"The following code has some disturbing syntax that could cause high blood pressure, anxiety, and other negative health effects. Drink responsibly after you view this code"
:)
Happy Thanksgiving.

>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.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform