Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
bobmcclellan
Starting Member
46 Posts |
Posted - 2011-09-30 : 22:27:13
|
Is there any benefit to using Set?using declare @RangeStart datetime,@RangeEnd datetimeset @RangeStart = '3/1/11'set @RangeEnd = '3/31/11'as opposed to declare @RangeStart datetime, @RangeEnd datetimeselect @RangeStart = '3/1/11',@RangeEnd = '3/31/11'tia,..bob |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-09-30 : 23:56:06
|
Should have a look at this article |
 |
|
Kristen
Test
22859 Posts |
Posted - 2011-10-01 : 05:40:41
|
"Is there any benefit to using Set?"We don't bother. Prefer to be able to assign multiple values in one statement.For @@ERROR and @@ROWCOUNT you have to use SELECT so that both can be assigned in one statement, so to keep in consistent (if nothing else) we use SELECT for all @Variable assignments.The single-row limit benefit might be a reason, but we would be checking @@ROWCOUNT (and @@ERROR) anyway ... |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
bobmcclellan
Starting Member
46 Posts |
Posted - 2011-10-04 : 11:06:45
|
Thanks to all of you. I appreciate the replies and info. |
 |
|
|
|
|