Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 958299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:50:32+00:00 2026-05-16T00:50:32+00:00

I use sql server 2005 enterprise, windows server 2003. I try execute osql.exe command,

  • 0

I use sql server 2005 enterprise, windows server 2003.

I try execute osql.exe command, for execute sql file in my server DESSQL:

osql.exe -E -n-1 -i"CarpetaUno\TextFile1.sql"

I get this error:

Msg 102, Level 15, State 1, Server DESSQL, Line 1
Incorrect syntax near 'n'

UPDATE:

I try this too,

osql.exe -E -i"CarpetaUno\TextFile1.sql"

1> 2> Msg 102, Level 15, State 1, Server DESSQL, Line 1
Incorrect syntax near 'n'

Finally, I use SQLCMD command:

SQLCMD -E -b -i”CarpetaUno\TextFile1.sql”

But not works using osql command !!

I test:

1.) using -S ServerName option,

2.) using absolute path: osql.exe -E –i C:\CarpetaUno\TextFile1.sql

3.) TextFile1.sql contents, is OK, I test using SSMS

CREATE DATABASE PRUEBA;

DROP DATABASE PRUEBA;

but I get the same error, in all tests.

Can it fails if I use utf-8 encoding in file ???

any solutions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:50:32+00:00Added an answer on May 16, 2026 at 12:50 am

    I think you’re barking up the wrong tree..

    Error 102 is incorrect SQL syntax, more than likely from the source SQL file.

    Update
    I think you’ve answered your own question..
    OSQL accepts ANSI and Unicode encoded files, BUT I tried opening my file with notepad++ changed the encoding to UTF-8 and I got similar errors.

    A quick google gave me this and this with a little bit more information.

    The bottom line is: Use SQLCMD.exe

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently use SQL Server 2005 Enterprise for our fairly large application, that has
I have tried to restore a database in SQL Server 2005 enterprise edition on Windows
I use SQL Server 2005. I have a simple logging table that my web
I'm trying to use SQL Server Profiler (2005) to track down some application performance
I would like to know how can I use tinyint in SQL Server 2005
We use a software which uses Sql server 2005 as back-end. The problem is
We currently have in production SQL Server 2005 and we use it's full text
I was wondering if i can use a single query in sql server 2005
I use sql-server-2005,My database contains many tables. When I explore my db, I see
I use SQL Server 2005, I have a database which uses full-text catalog. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.