SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 OSQL script to SQLCMD script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

lostgolfballs
Starting Member

USA
5 Posts

Posted - 10/08/2012 :  16:32:08  Show Profile  Reply with Quote
Hi,

We have an old OSQL script that is not working on the computers. I did some research and found out the command will work if it's converted to SQLCMD.

Since I'm not a SQL programmer, how can i convert the OSQL to SQLCMD script?

The original command line is

osql -Q "USE (DB Name) EXEC sp_importFedExData" -S(Db Path) -Usa -P(DB name)

tkizer
Almighty SQL Goddess

USA
36845 Posts

Posted - 10/08/2012 :  16:34:58  Show Profile  Visit tkizer's Homepage  Reply with Quote
Can't you just replace osql with sqlcmd?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

lostgolfballs
Starting Member

USA
5 Posts

Posted - 10/08/2012 :  16:49:45  Show Profile  Reply with Quote
I tried and it came out with bunch of errors like
"an unexpected end of file was encountered in the data file."
"msg 7399, level 16, state 1, server (DB name) line 1"


quote:
Originally posted by tkizer

Can't you just replace osql with sqlcmd?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

Go to Top of Page

tkizer
Almighty SQL Goddess

USA
36845 Posts

Posted - 10/08/2012 :  16:51:54  Show Profile  Visit tkizer's Homepage  Reply with Quote
sqlcmd -Q "EXEC DbName.dbo.sp_importFedExData" -Sserver1 -Usa -Ppassword

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

lostgolfballs
Starting Member

USA
5 Posts

Posted - 10/09/2012 :  09:27:13  Show Profile  Reply with Quote
I ran the command and it cambe back.
msg2812, level 16, state 62, server (server name), line 1
could not find the stored procedure '(dbname.dbo)'


quote:
Originally posted by tkizer

sqlcmd -Q "EXEC DbName.dbo.sp_importFedExData" -Sserver1 -Usa -Ppassword

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

Go to Top of Page

xhostx
Constraint Violating Yak Guru

USA
277 Posts

Posted - 10/09/2012 :  11:47:52  Show Profile  Reply with Quote
I would go first to SQL server Query Analyzer and run that sp. if it succeed than you will be looking at changing your parameters of isql/osql/sqlcmd.

Also, look at what version of MS SQLserver you are running because that could be a cause too.

--------------------------
Joins are what RDBMS's do for a living
Go to Top of Page

lostgolfballs
Starting Member

USA
5 Posts

Posted - 10/09/2012 :  12:05:55  Show Profile  Reply with Quote
quote:
Originally posted by xhostx

I would go first to SQL server Query Analyzer and run that sp. if it succeed than you will be looking at changing your parameters of isql/osql/sqlcmd.

Also, look at what version of MS SQLserver you are running because that could be a cause too.

--------------------------
Joins are what RDBMS's do for a living

Go to Top of Page

lostgolfballs
Starting Member

USA
5 Posts

Posted - 10/09/2012 :  12:07:09  Show Profile  Reply with Quote
accident on the last post...
this is what i got from the analyzer.
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'Q'.


quote:
Originally posted by lostgolfballs

quote:
Originally posted by xhostx

I would go first to SQL server Query Analyzer and run that sp. if it succeed than you will be looking at changing your parameters of isql/osql/sqlcmd.

Also, look at what version of MS SQLserver you are running because that could be a cause too.

--------------------------
Joins are what RDBMS's do for a living



Go to Top of Page

xhostx
Constraint Violating Yak Guru

USA
277 Posts

Posted - 10/09/2012 :  13:43:27  Show Profile  Reply with Quote
you only need to execute the following on SQL analyzer:
"USE (DB Name) EXEC sp_importFedExData


--------------------------
Joins are what RDBMS's do for a living
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000