Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 sp - if and else

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2005-03-22 : 06:28:16
I have an if statement in a stored procedure as follows:

if @amount=1 and @value=1
begin
select @pp=1
end

I want to add an else @pp=0

What's the correct syntax?

Kristen
Test

22859 Posts

Posted - 2005-03-22 : 07:05:42
if @amount=1 and @value=1
begin
select @pp=1
end
ELSE
begin
select @pp=0
end


Kristen
Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2005-03-22 : 07:34:47
thanks for you help.

How would I set variables I declare to be a default of 0

DECLARE
@isdouble tinyint,
@pp int
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-22 : 08:12:46
DECLARE
@isdouble tinyint,
@pp int
select @isdouble = 0, @pp = 0

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -