| Author |
Topic |
|
salimsql
Starting Member
5 Posts |
Posted - 2006-06-16 : 02:44:25
|
| Msg 102, Sev 15, State 1, Line 134 : Incorrect syntax near 'ge'. [SQLSTATE 42000]hiI 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.ThanksJohn |
|
|
psawant
Starting Member
14 Posts |
Posted - 2006-06-16 : 03:11:51
|
| Just look if you missed any variable or some declare part of your query?Are you running this query as t-sql or from file in job? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-06-16 : 03:29:22
|
quote: Originally posted by salimsql Msg 102, Sev 15, State 1, Line 134 : Incorrect syntax near 'ge'. [SQLSTATE 42000]
Post sp here. Something is going wrong at line 134 in your sp. Is the query a dynamically built query with 134 rows?Peter LarssonHelsingborg, Sweden |
 |
|
|
CSK
Constraint Violating Yak Guru
489 Posts |
Posted - 2006-06-16 : 03:37:02
|
| tell us if that query is dynamic or static..?this is mostly for Syntax error or access violationsee the permission and owner also for that table and sp also |
 |
|
|
salimsql
Starting Member
5 Posts |
Posted - 2006-06-16 : 07:42:24
|
| hipart of the query (entirely T-SQL) is dynamic (but not all). The dynamic part spans over 233 lines. That is, I have put an SQL statement in a string variable (@SQLString) and then I execute it thus:EXEC (@SQLString)The whole query (non-dynamic part and all) works perfect in Studio (SQL Server 2005). But if I take the same query and paste in in the Command box for step 1 of job1 and then start job1, I get the error. |
 |
|
|
salimsql
Starting Member
5 Posts |
Posted - 2006-06-16 : 07:57:48
|
| even if i run the non-dynamic part in a seperate job, i still get a similar error |
 |
|
|
psawant
Starting Member
14 Posts |
Posted - 2006-06-16 : 08:26:52
|
| Are you using any cursor in your query?How are you building your query is it a static or build’s on different condition's?------------------------Prakash Sawanthttp://psawant.blogspot.com |
 |
|
|
salimsql
Starting Member
5 Posts |
Posted - 2006-06-16 : 09:08:54
|
| no cursor. A lot of conditions. |
 |
|
|
mr_mist
Grunnio
1870 Posts |
Posted - 2006-06-16 : 09:32:13
|
| My guess, your dynamically built query is being preemptively cut off because the variable holding it is too short.try doing a PRINT of the query instead of executing it.-------Moo. :) |
 |
|
|
salimsql
Starting Member
5 Posts |
Posted - 2006-06-19 : 02:24:34
|
| hiUnfortunately, if I take only the static part (no dynamic code included) and run it as a job, I still get the problem. |
 |
|
|
pradeepmm
Starting Member
1 Post |
Posted - 2007-06-20 : 12:36:17
|
| Hi Salim, I am not sure if you have your problem fixed. I had a similar issue.On looking around the answers and working it out. Check for the following possiblities1. Check for the (lines of code)loc on the sql script.2. SQL JOB does not execute scripts that are more that 800 loc.Pradeep MMPh: Off: (080) 634 9878/81 Extn: 23Res: 343 4654 |
 |
|
|
mrmankge
Starting Member
1 Post |
Posted - 2012-04-03 : 09:15:29
|
| I had the same problem and After a long struggle and research, I found out that I had to put in each of my execute @sSQL in the brackets like before - execute @sSQLafter - execute (@sSQL) |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2012-04-03 : 09:34:24
|
| I find that when i resurrect 5 year old threads, i piss off a lot of people...How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
|