Your not executing your sql string. Try something like this (untested):
create procedure mimo (@id varchar)
as
declare @strSql varchar(250)
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'
end
exec (@strSql)
Mark
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
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 the Yahoo! Terms of Service.
[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/