Help with T-SQL Syntax

  • New to T-SQL.

    I code this:

    If @MonthLit = 'January' Set @Period = 1

    Else If @MonthLit = 'February' Set @Period = 2

    Else If @MonthLit = 'March' Set @Period = 3

    Else If @MonthLit = 'April' Set @Period = 4

    Else If @MonthLit = 'May' Set @Period = 5

    Else If @MonthLit = 'June' Set @Period = 6

    Else If @MonthLit = 'July' Set @Period = 7

    Else If @MonthLit = 'August' Set @Period = 8

    Else If @MonthLit = 'September' Set @Period = 9

    Else If @MonthLit = 'October' Set @Period = 10

    Else If @MonthLit = 'November' Set @Period = 11

    Else If @MonthLit = 'December' Set @Period = 12

    Else RaiseError('Invalid month', 10 , 1)

    And get this error message:

    Msg 102, Level 15, State 1, Procedure cspGE2005, Line 23

    Incorrect syntax near 'RaiseError'.

    Can someone show me how to properly code this structure?

    Thanks.

  • It should be Raiserror (with a single 'e')

  • Well Junkie...I feel real stupid now for asking.

    Thanks!

  • Yes' it's a pitty there's no F7 in SMS...;)

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply