Solve the strange problem caused by comments in SQL scripts

Source: Internet
Author: User

In the data warehouse installation package, we used the osql.exe tool to update the relevant database script. Yesterday we suddenly found that the installation package reported an error, saying that the script is wrong, but we took the script to the database query analyzer for execution, everything is OK.

Where is the problem?

Execute the error script separately using osql to print the relevant information:
Copy codeThe Code is as follows:
Osql.exe-S. \ SQLDEV-U sa-P MyRoot-B-n-r 1-I ". \ UpdateTable. SQL"-o "c: \ hahah.txt"
@ Echo % errorlevel %
@ Pause

The following error message is displayed:

Osql Missing end comment mark "*/"

Fainted, saying that my annotator is missing, but there is no less.

Finally, we found that there was a GO statement problem in the comment statement, as shown below:

/* ...... GO */

After it is removed, everything is normal. It seems that this is also a small BUG of the osql tool.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.