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)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|||Gary, I gotta ask...
Almost all your previous posts have been in the recruitment forum. Why are you suddenly asking basic TSQL questions?|||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.|||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 :)|||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.|||yeah, it's the truth. Who want to put that out there|||Okey-doke. Post away.
No comments:
Post a Comment