Results 1 to 8 of 8

Thread: erron handling

  1. #1
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770

    Cool Unanswered: erron handling

    Hey Gang, got one for you.
    error message:
    Server: Msg 137, Level 15, State 2, Line 19
    Must declare the variable '@EFFECTIVE_DATE'.
    Code:
    SELECT LOG_PK,
    LOG_REQUESTOR,
    LOG_REQ_PHONE,
    LOG_CHAR_60_1,
    LOG_CHAR_30_4,
    LOG_CN_FK,
    LOG_CREATE_DATE,
    LOG_REQUEST,
    (LOG_STATUS),
    (LOG_TYPE),
    LOG_FU_FK,
    LOG_FB_PK,
    LOG_LT_FK,
    LOG_CREATE_DATE
    FROM f_Requests
    WHERE LOG_RQ_FK IS NOT NULL AND
    LOG_LT_FK <> 10174 AND
    LOG_RC_CODE = S
    AND (LOG_MOD_DATE > @EFFECTIVE_DATE OR
    LOG_CREATE_DATE > @EFFECTIVE_DATE)

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi Garry

    Is that all the code? If so then - the error message is a good clue - you need to declare (and set) a variable called @EFFECTIVE_DATE - probably of SmallDateTime or DateTime type (check the schema you are comparing it against).

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Gary, I gotta ask...
    Almost all your previous posts have been in the recruitment forum. Why are you suddenly asking basic TSQL questions?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770

    Cool Error handling

    You really wont to know. Almost 5 months ago I was working as with both oracle and Sql server as a dba. I've been doing this for a long time but know since the accident my memory is almost 50%. I litterly had people come to see me in the hospital and did'nt know who they are. The Dr. says it will get better. Why do you think my post stop. That's the story. I need al the help I can get to get back to were I was. This is the starting point.

  5. #5
    Join Date
    Nov 2005
    Location
    San Francisco, CA
    Posts
    506
    Hi Garry,
    Thanks for the reply through pm.
    Check this out...
    declare @EFFECTIVE_DATE datetime

    set @EFFECTIVE_DATE ='GIVE YOUR DATE HERE' --- or pass your date using
    --- this variable

    SELECT LOG_PK,
    LOG_REQUESTOR,
    LOG_REQ_PHONE,
    LOG_CHAR_60_1,
    LOG_CHAR_30_4,
    LOG_CN_FK,
    LOG_CREATE_DATE,
    LOG_REQUEST,
    (LOG_STATUS),
    (LOG_TYPE),
    LOG_FU_FK,
    LOG_FB_PK,
    LOG_LT_FK,
    LOG_CREATE_DATE
    FROM f_Requests
    WHERE LOG_RQ_FK IS NOT NULL AND
    LOG_LT_FK <> 10174 AND
    LOG_RC_CODE = S
    AND (LOG_MOD_DATE > @EFFECTIVE_DATE OR
    LOG_CREATE_DATE > @EFFECTIVE_DATE)
    Thanks again for the pm
    Success is the ability to go from one failure to another with no loss of enthusiasm.
    - Sir Winston Churchill
    Joydeep

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by garrydawkins
    You really wont to know. Almost 5 months ago I was working as with both oracle and Sql server as a dba. I've been doing this for a long time but know since the accident my memory is almost 50%. I litterly had people come to see me in the hospital and did'nt know who they are. The Dr. says it will get better. Why do you think my post stop. That's the story. I need al the help I can get to get back to were I was. This is the starting point.
    If you're being straight with us, you'll get a lot of support here. If you're not, well, gloves come off.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  7. #7
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770

    Cool Error handling

    yeah, it's the truth. Who want to put that out there

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Okey-doke. Post away.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •