You are here: optional parameter in sql query « MsSQL Server « IT news, forums, messages
optional parameter in sql query

Posted by parez on 11/06/05 21:38

Hi All,

I have a stored proc which looks like this.

Create ....
(
@id int,
@ud int,
@td int=0
)

if @td=0
select bkah from asdf where id=@id and ud=@ud
else
select bkah from asdf where id=@id and ud=@ud and td=@td

---------------------------------
I am wondering if i could replace if condition with the following line

select bkah from asdf where id=@id and ud=@ud
and ( @td<>0 and td>@td )

IS sql server 2000 smart enough not to use the td>@td in the query if
@td is 0


Thanks all

 

Navigation:

[Reply to this 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

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