June 16, 2006 at 12:50 am
hi
I have a script which worked fine in SQL SERVER 2000. We have now upgraded to SQL SERVER 2005 (SP1). When I run the script from Query Analyser it works fine. But when I schedule the same script to run as a job, it fails and i get the following error:
Msg 102, Sev 15, State 1, Line 134 : Incorrect syntax near 'ge'. [SQLSTATE 42000]
Now, there is no problem with the syntax.
What could be the problem?? I have been searching for a logical answer on the Internet and although other people seem to have encontered a similar problem, I have yet to find an answer.
Million thanks if u can help.
Thanks
John
June 16, 2006 at 1:19 am
copy/paste the query in SQL Server Management Studio (sql2005 !)
You'll notice it has problems with carriage-returns char(13).
You'll have to replace them with char(10).
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
June 16, 2006 at 5:23 am
I think there is a confusion here. Allow me to clarify...
After u suggested that I replace char(13) by char(10), I tried 2 things.
1. I made a php script to replace all end of line characters char(13) by char(10) in the file containing the script. When i run the resulting file as a job, the error which was at line 680 has moved to line 1319. So part of the problem was what u hinted at. But the problem is not solved
2. But as I do have the word "char(13)" typed in my code, I have removed this from the code. This has no effect when run as a job. The problem persists.
Perhaps there is some other character, apart from char(13) that has to be removed from the file?
Thanks for your help.
June 16, 2006 at 5:29 am
Did you check what statement is at line 1319.
In sql2005 management studi, there is this handy option for the query editor to show linenumbers.
tools/options/texteditor/all languages
check line numbers
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
June 16, 2006 at 5:42 am
At line 1319, there is only the word OR. Pls see snippet below.
---------------------- Snippet below ----------
ANDc.CreateDate<=(CAST((CAST (datepart(yyyy,getdate()) AS VARCHAR) + '-' + CAST (datepart(mm,getdate()) AS VARCHAR) + '-' + '01' ) + ' 5:00:00' as datetime))
)
-- .................................................................
OR
-- .................................................................
-- To cater for a bill that has been created on the very last
June 16, 2006 at 5:55 am
well, this may sound a bit odd, but did you try retyping that querypart from the and clause up to the end of the full query ?
- maybe even a copy/paste to notepad and a new copy/past back may even solve the issue
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
June 16, 2006 at 6:04 am
tried copy/paste to notepad n copy/paste back. same prob.
As a last resort i will retype the whole code. But it contains
2185 lines!!!!!
June 16, 2006 at 6:14 am
Start with just that code at line 1319
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply