• Error: 'osql' is not recognized as an internal or external command, operable program or batch file.

Analysis/solution:
OSQL.exe does not exist on the machine you're running the script. Luckily, OSQL is a stand-alone utility. You can just copy it from another computer.

Or, if you prefer, run the script on a machine that has already installed the SQL Server Management tools.

  • Error: XXX was unexpected at this time

Analysis/solution:
The script must be missing the "^" symbol before a special symbol such as parenthesis. This would only happen if you changed the SQL statements section within the script.

  • Error: Msg 170, Level 15, State 1, Server <ServerName>, Line 3
    Line 3: Incorrect syntax near XXX.

Analysis/solution
The error above is an example of a SQL Server error due to incorrect syntax. This can also happen if you change the SQL statements in the script and you forgot to add the "^" symbol before a parenthesis.

    Requires Free Membership to View


Overcoming Basis challenges by reaching inside the database

 Home: Introduction
 Basis challenge #1: Reporting logon information
 Basis challenge #2: Gathering SQL Server information
 Basis challenge #3: Getting system profile parameters
 Troubleshooting
 Review: Conclusion and more resources

This was first published in December 2005

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.