>>Another newbie question.
>>
>>I can set a value to a variable in a stored procedure using SET or SELECT. E.g.
>>
>>set @MyVar = 0
>>select @MyVar = 0
>>
>>
>>Which approach is a better practice and why?
>>
>>TIA
>
>For a single variable assignment it doesn't really matter. With SELECT you can set multiple variables at once so if you need to set values for several variables, I prefer SELECT statement.
>
>Also, if you use
>
>select @myVar = someColumn where ConditionEvaluatesToFalse
>
>then the initial value of the @myVar (NULL) will not change. Just be aware of that fact.
Thank you.
"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