Reply to Re: general question

Your name:

Reply:


Posted by Alex Kuznetsov on 08/02/07 00:46

On Jul 26, 12:59 pm, "MikeJ" <vettes_n_j...@sbcglobal.net> wrote:
> hi...i would like to know best practice when assigning a value to a variable
> example below
>
> set
> or
> select
>
> declare @var1 varchar(25)
> set @var1='abc'
> select @var1='abc'
>
> to me
> set is implicit
> select implies conditions
>
> i see both used all over the place here at my new company....
> so witch is better practice
>
> tks
> MJ

Mike,

If you need to do many assignments at once, a single assignment

SELECT @var1 = @value1,
(snip)
@var9 = @value9

may run faster than

SET @var1 = @value1
(snip)
SET @var9 = @value9

Verify that. I did benchmarks on 2000 and noticed a difference, but
did not repeat on 2005.

Alex Kuznetsov, SQL Server MVP
http://sqlserver-tips.blogspot.com/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация