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)
 CASE help please!!

Author  Topic 

d
Starting Member

26 Posts

Posted - 2005-07-05 : 08:51:07
I am struggling with the basics, this does not work for me:

declare @Term int
declare @IPTRate decimal
set @Term = 12
select @Term

select case
when @Term = 12 then @IPTRate = 0.00325
when @Term = 24 then @IPTRate = 0.00374
when @Term = 36 then @IPTRate = 0.00487
when @Term = 48 then @IPTRate = 0.00489
when @Term = 60 then @IPTRate = 0.00429
else
@IPTRate = 0
end

select @IPTRate


It returns:
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'when'.

Can anyone help me please??

Many Thanks

Kristen
Test

22859 Posts

Posted - 2005-07-05 : 08:52:54
select @IPTRate = case
when @Term = 12 then 0.00325
when @Term = 24 then 0.00374
when @Term = 36 then 0.00487
when @Term = 48 then 0.00489
when @Term = 60 then 0.00429
else
0
end

Kristen
Go to Top of Page

d
Starting Member

26 Posts

Posted - 2005-07-05 : 08:55:36
YOU ARE A STAR :) !
Go to Top of Page
   

- Advertisement -