There is a change in my earlier answer if @strSql is not a parameter 
of ur procedure then u can declare that after as begin . no problem 
 
AC

imane elfechtani <[EMAIL PROTECTED]> wrote:
Hello,

I was wondering, can we have a stored procedure with a divided query? 
I have tried the following, and it doesn't seem to work:

create procedure mimo (@id varchar)
as begin
declare @strSql varchar
set @strSql = (select * from vm_property) 
IF @id = 1
begin 
set @strSql = @strSql + 'where vm_property.propertyId=1' 
End 
ELSE 
begin 
set @strSql = @strSql + 'where vm_property.propertyId=4'
Go

Thank 

Imane


---------------------------------
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.

[Non-text portions of this message have been removed]




Yahoo! Groups Links










Thanks & Regards

Arindam 
Web Designer & Developer  




Yahoo! India Matrimony: Find your life partneronline.

[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to