stored proc snippet - rodcha

12-Sep-07 02:06:03
hey all,

SELECT @currentVacationAccrualRate =
CASE @PPE_ToDate
WHEN BETWEEN 0 AND 48 THEN 3.34
WHEN BETWEEN 49 AND 120 THEN 5.00
WHEN > 120 THEN 6.67
END

It doesn't like the first BETWEEN  for some reason?

thanks,
rodchar
reply
 
 

stored proc snippet - SQL Menace

12-Sep-07 02:20:43
Try this

SELECT @currentVacationAccrualRate =
CASE
WHEN @PPE_ToDate BETWEEN 0 AND 48 THEN 3.34
WHEN @PPE_ToDate BETWEEN 49 AND 120 THEN 5.00
WHEN @PPE_ToDate > 120 THEN 6.67
END



Denis The SQL Menace
http://sqlservercode.blogspot.com
http://sqlblog.com/blogs/denis_gobo/default.aspx
reply
 

stored proc snippet - TheSQLGuru

12-Sep-07 02:40:10
I believe the example you use (which is one of TWO available syntaxes for
the CASE statement) can only test ONE single value of @PPE_ToDate for each
WHEN clause.  See SQLMenace's solution for the one that allows you to test a
range of values.

--
TheSQLGuru
President
Indicium Resources, Inc.
reply
 

stored proc snippet - rodcha

12-Sep-07 03:38:02
thanks everyone for the help.
rod.
reply
 
Selecting part of a string
promotion
Silverlight    WPF    WCF    WWF    LINQ   
JavaScript    AJAX    ASP.NET    XAML   
C#    VB.NET    VB 6.0    GDI+    IIS    XML   
.NET Generics    Anonymous Methods    Delegate   
Visual Studio .NET    Expression Blend    Virus   
Windows Vista    Windows XP    Windows Update   
Windows 2003 Server    Windows 2008 Server   
SQL Server    Microsoft Excel    Microsoft Word   
SharePoint    BizTalk    Virtual Earth   
.NET Compact Framework    Web Service   

"Everything" RSS / ATOM Feed Parser
How to send and receive messages through message queuing in .Net
How to Read text file as database
SQL Server 2005 Paging Performance Tip
Display code of web page.
Fully Scalable Excel File Importer class for .net using Microsoft Jet driver
Generic Chart Color Manager class that can be used for any charts
Helper class to style the infragistics wingrid
Using Reflection to detemine as Assembly Info in and out.
Helper class to play with Window (Owners and position)
Resolving displayname from the culture using the XmlLanguage and LanguageSpecificStringDictionary class