Raghavendra Mudugal (8/19/2014)
The pro is of course that if you put all the declarations combined with assignment in a non-repeated part of the stored procedure, trigger, or batch the assignments get executed exactly once, so the net effect is much the same as declaration with initialisation to a chosen value and this can quite useful for making the code easier to read (it reduces clutter).
Thank you, Tom. When I came to know the in-line assignment types, I said, great as I did in VB.NET, now I can do in SQL too, probably, in future versions there will also be an option to mention ByVal or ByRef (like stuff) in procedure/function level....and slowing sql scripting will be taken over by OOPS concepts.
It would be something of a catastrophe if SQL adopted OOPS concepts - it would stand a serious risk of degenerating into an appallingly awful mess like C++, wrecking the concept of data abstraction, and making set-oriented queries impossible to write (requiring RBAR iterators). Of course if competent academics made an OOPS-ified version of SQL it might not suffer those catastrophes, but competent academics wouldn't get a lookin because ANSI and ISO are effectively dominated by players from the IT industry.