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