June 16, 2006 at 12:48 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:10 am
Run the script in SQL2005 SQL Server Management Studio.
It has problems with char(13) linebrakes.
Change them to 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 2:14 am
Thanks for the tip.
But how can I change char(13) to char (10)? They are both linebrakes and I cannot do a find and replace.
I have also tried pasting the code in Textpad and copied the code from Texpad and pasted in the Command space available for the job step. Same problem!!
Thanks in advance
June 16, 2006 at 8:38 am
here's a replace I tested in QA 2000 - works fine..
declare @str varchar(10) declare @position tinyint set @position = 1 set @str = 'hu' + char(13) + 'll' + char(10) + 'o' set @str = replace(@str, char(13), char(10)) WHILE @position <= DATALENGTH(@str) BEGIN SELECT ASCII(SUBSTRING(@str, @position, 1)), CHAR(ASCII(SUBSTRING(@str, @position, 1))) SET @position = @position + 1 END
**ASCII stupid question, get a stupid ANSI !!!**
June 16, 2006 at 8:52 am
IF it's a text column having data less then 4000 char then use this
REPLACE(CAST(<column_name> AS Nvarchar(4000)),char(13),char(10)) AS column_name
Or if its a varchar column then try this.
REPLACE(<column_name>,char(13),char(10)) AS column_name
------------
Prakash Sawant
http://psawant.blogspot.com
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy