|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Which one is faster?Which one is faster (regarding compilation time and execution time):
SELECT @var1=(some expression), @var2=(other expression), [...] @var6=(last expression) or: SET @var1=(some expression) SET @var2=(other expression) [...] SET @var6=(last expression) All expressions are arithmetical expressions based on other variables (and maybe some built-in functions, like ROUND) (but no subqueries, UDF-s, etc). The data type of the variables is usually money. The code will be in a stored procedure. Hi
WHICH IS BETTER VANILLA OR STRAWBERRY.THAT DEPENDS ON YOUR TONGUE. No difference as for as cost and performance.Absolutely both are same. Regards R.D Show quote "Ion Popescu" wrote: > Which one is faster (regarding compilation time and execution time): > > SELECT @var1=(some expression), > @var2=(other expression), > [...] > @var6=(last expression) > > or: > > SET @var1=(some expression) > SET @var2=(other expression) > [...] > SET @var6=(last expression) > > All expressions are arithmetical expressions based on other variables > (and maybe some built-in functions, like ROUND) (but no subqueries, > UDF-s, etc). The data type of the variables is usually money. The code > will be in a stored procedure. > > Yes, but which is *faster*: a vanilla bean or a strawberry?
Show quote "R.D" <R*@discussions.microsoft.com> wrote in message news:92D1FFEB-90ED-41F5-B323-57498AEFD8B0@microsoft.com... > Hi > WHICH IS BETTER VANILLA OR STRAWBERRY.THAT DEPENDS ON YOUR TONGUE. > No difference as for as cost and performance.Absolutely both are same. > Regards > R.D > > "Ion Popescu" wrote: > >> Which one is faster (regarding compilation time and execution time): >> >> SELECT @var1=(some expression), >> @var2=(other expression), >> [...] >> @var6=(last expression) >> >> or: >> >> SET @var1=(some expression) >> SET @var2=(other expression) >> [...] >> SET @var6=(last expression) >> >> All expressions are arithmetical expressions based on other variables >> (and maybe some built-in functions, like ROUND) (but no subqueries, >> UDF-s, etc). The data type of the variables is usually money. The code >> will be in a stored procedure. >> >> Vanilla. Any other answer makes you just wrong :)
-- Show quote---------------------------------------------------------------------------- Louis Davidson - http://spaces.msn.com/members/drsql/ SQL Server MVP "Arguments are to be avoided: they are always vulgar and often convincing." (Oscar Wilde) "R.D" <R*@discussions.microsoft.com> wrote in message news:92D1FFEB-90ED-41F5-B323-57498AEFD8B0@microsoft.com... > Hi > WHICH IS BETTER VANILLA OR STRAWBERRY.THAT DEPENDS ON YOUR TONGUE. > No difference as for as cost and performance.Absolutely both are same. > Regards > R.D > > "Ion Popescu" wrote: > >> Which one is faster (regarding compilation time and execution time): >> >> SELECT @var1=(some expression), >> @var2=(other expression), >> [...] >> @var6=(last expression) >> >> or: >> >> SET @var1=(some expression) >> SET @var2=(other expression) >> [...] >> SET @var6=(last expression) >> >> All expressions are arithmetical expressions based on other variables >> (and maybe some built-in functions, like ROUND) (but no subqueries, >> UDF-s, etc). The data type of the variables is usually money. The code >> will be in a stored procedure. >> >> Ion Popescu wrote:
> Which one is faster (regarding compilation time and execution time): SELECT (as a single statement) may be faster than a number of SETs> > SELECT @var1=(some expression), > @var2=(other expression), > [...] > @var6=(last expression) > > or: > > SET @var1=(some expression) > SET @var2=(other expression) > [...] > SET @var6=(last expression) (multiple statements). This can make practical difference if used in a loop. Microsoft recommends using SET over SELECT as the latter is not standard. On Fri, 02 Sep 2005 14:01:27 GMT, Sericinus hunter <serh***@flash.net> wrote:
in <XWYRe.3786$v83.2***@newssvr33.news.prodigy.com> Show quote >Ion Popescu wrote: Yeah, well Microsoft also recommends that you trash any VB6 code you may have in>> Which one is faster (regarding compilation time and execution time): >> >> SELECT @var1=(some expression), >> @var2=(other expression), >> [...] >> @var6=(last expression) >> >> or: >> >> SET @var1=(some expression) >> SET @var2=(other expression) >> [...] >> SET @var6=(last expression) > >SELECT (as a single statement) may be faster than a number of SETs >(multiple statements). This can make practical difference if >used in a loop. > >Microsoft recommends using SET over SELECT as the latter is not >standard. favor of VB.NET so what are you gonna do? --- Stefan Berglund > Yeah, well Microsoft also recommends that you trash any VB6 code you may Use T-SQL for everything? :)> have in > favor of VB.NET so what are you gonna do? -- Show quote---------------------------------------------------------------------------- Louis Davidson - http://spaces.msn.com/members/drsql/ SQL Server MVP "Arguments are to be avoided: they are always vulgar and often convincing." (Oscar Wilde) "Stefan Berglund" <keepit@in.thegroups> wrote in message news:kc8nh1plg5dbgl85rkkqr71unoa9do2gru@4ax.com... > On Fri, 02 Sep 2005 14:01:27 GMT, Sericinus hunter <serh***@flash.net> > wrote: > in <XWYRe.3786$v83.2***@newssvr33.news.prodigy.com> > >>Ion Popescu wrote: >>> Which one is faster (regarding compilation time and execution time): >>> >>> SELECT @var1=(some expression), >>> @var2=(other expression), >>> [...] >>> @var6=(last expression) >>> >>> or: >>> >>> SET @var1=(some expression) >>> SET @var2=(other expression) >>> [...] >>> SET @var6=(last expression) >> >>SELECT (as a single statement) may be faster than a number of SETs >>(multiple statements). This can make practical difference if >>used in a loop. >> >>Microsoft recommends using SET over SELECT as the latter is not >>standard. > > Yeah, well Microsoft also recommends that you trash any VB6 code you may > have in > favor of VB.NET so what are you gonna do? > > --- > Stefan Berglund |
|||||||||||||||||||||||