mzim
Well-known member
i have this problem in declaring parameter in stored proc.
btw i'm using mssql 2000
the usual thing to do is
but what i want is to declare a parameter inside a condition or declaring a parameter that are not global
how can i do that? bec. it throws an error if you will not provide a value to the parameter eventhough you will not using it. I just want to pass a value in a parameter if it will be needed.
thanks in advance for the help.
cheers
marzim
btw i'm using mssql 2000
the usual thing to do is
VB.NET:
@name varchar(50)
insert into sampletable values(@name)
but what i want is to declare a parameter inside a condition or declaring a parameter that are not global
VB.NET:
@ident int
if @ident=1
[color=red]@names varchar(50)[/color]
begin
insert into table1 values(@names)
end return
if @ident=2
[color=red]@add varchar(50)[/color]
begin
insert into table2 values(@add)
end
how can i do that? bec. it throws an error if you will not provide a value to the parameter eventhough you will not using it. I just want to pass a value in a parameter if it will be needed.
thanks in advance for the help.
cheers
marzim