Guys, I need some help with the osql.exe sql server 2000 command line utility.
For the most part everything works fine except... I have really large SQL files to execute. These files are automatically generated and FTP'd to a directory. There is a Windows Service that runs on that machine and watches for these files and then executes them with the OSQL.exe utility. Some of them are in excess of 200MB in size. The statements are separated about every 200-250 statements (I don't remember which) with a GO. These are generated from various databases. The database models are the same, but the the data contained is different. When most of these are run they run correctly without incident or errors. However, when one of them runs, it runs improperly and I get all kinds of weird errors. I was able to deduce exactly where the portion of sql code was that was causing the problem. When I extract that portion of code, and run it in Query Analyzer or in OSQL.exe it works fine. So, it seems to be in conjunction with the entire file. Here's the original errors I got: 170 15 1 SSWEB1 185 284995 Line 185: Incorrect syntax near '0010051824'. 170 15 1 SSWEB1 167 284997 Line 167: Incorrect syntax near '0010223300'. 170 15 1 SSWEB1 229 285002 Line 229: Incorrect syntax near '0011117110'. 170 15 1 SSWEB1 36 289525 Line 36: Incorrect syntax near '0011152960'. 105 15 1 SSWEB1 252 289527 Unclosed quotation mark before the character string ', 76000.0000, 0 ) 170 15 1 SSWEB1 227 289530 Line 227: Incorrect syntax near '0011348600'. 170 15 1 SSWEB1 38 289532 Line 38: Incorrect syntax near '0011379350'. 105 15 1 SSWEB1 252 289534 Unclosed quotation mark before the character string ', 46500.0000, 0 ) 170 15 1 SSWEB1 21 289537 Line 21: Incorrect syntax near '0011485750'. 170 15 1 SSWEB1 159 289539 Line 159: Incorrect syntax near '0011539450'. After adding some print statements to the generated data to see what was going on here's a portion of what I get now: 170 15 1 SSWEB1 550 1682306 Line 550: Incorrect syntax near 'LINE:'. 170 15 1 SSWEB1 748 1682308 Line 748: Incorrect syntax near 'LINE:'. 132 15 1 SSWEB1 748 1682311 The label 'Row' has already been declared. Label names must be unique within a query batch or stored procedure. 170 15 1 SSWEB1 175 1682313 Line 175: Incorrect syntax near 'LINE:'. 170 15 1 SSWEB1 226 1682315 Line 226: Incorrect syntax near 'LINE:'. 132 15 1 SSWEB1 226 1682318 The label 'Row' has already been declared. Label names must be unique within a query batch or stored procedure. 170 15 1 SSWEB1 496 1682320 Line 496: Incorrect syntax near 'LINE:'. 132 15 1 SSWEB1 496 1682323 The label 'Row' has already been declared. Label names must be unique within a query batch or stored procedure. 170 15 1 SSWEB1 682 1682325 Line 682: Incorrect syntax near 'LINE:'. 170 15 1 SSWEB1 103 1704917 Line 103: Incorrect syntax near 'LINE:'. 170 15 1 SSWEB1 457 1704919 Line 457: Incorrect syntax near 'LINE:'. 132 15 1 SSWEB1 457 1704922 The label 'Row' has already been declared. Label names must be unique within a query batch or stored procedure. Now, mind you there is literally 1000's of print statements and other INSERT statements before this occurs and 1000's after it occurs. But only in this one spot (with no discernible syntax or other problem) does it cause these errors. I'm really lost here as to the cause and how to fix it. Do any of y'all have any suggestions or ideas? Any would be most appreciated. Thanks, Mike =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com