Hi, can anyone help me with the following xp_cmdshell/osql problem?
To solve a problem with osql I use the two sql test-scripts. Script1 is
loaded in Sql Query Analyzer. Executing scripts 1: this calls en execute
script2, which prints a message to the output window. Quite simple.
My problem: this is functioning well on a my develop pc (Windows XP-Pro),
but is not functioning on a production server with Windows 2000 Server (SP4)
.
On this production machine, recently sql server 2000 SP3 has been installed,
and everything of sqlserver 2000 looks the same as on my develop pc under
XP-pro. The error reported is about the syntax usage of osql: "usage: osql
[-U login id] [-P password] [-S server]" and the all the rest of the option
s
..... So I should think it has something to do with the used syntax, but i
t
IS functioning on my develop pc!
I don't understand why these testscripts do work on my develop pc, and don't
on the production server. I guess it has something to do with either the
difference in OS, or a setting in the new sql installation on the production
server, but I can't find out the cause.
****************************************
**
Script1.sql:
DECLARE @.SqlPath sysname, @.SqlScript as sysname, @.Cmd sysname, @.CmdCpl
nvarchar(400), @.CmdAndPath sysname
SET @.Cmd = 'osql -S MyServer -d MyDb -Usa -PPwd -i'
SET @.SqlPath = 'C:\MyPathToScript2'
SET @.CmdAndPath = @.Cmd + @.SqlPath
SET @.SqlScript = 'Script2.sql'
SET @.CmdCpl = @.CmdAndPath + @.SqlScript
EXEC master..xp_cmdshell @.CmdCpl
****************************************
**
Script2.sql:
DECLARE @.Test varchar(255)
SET @.Test = 'Hello world'
PRINT @.Test
****************************************
**
Any suggestions are welcome,
Regards Coen.One possible cause is that @.CmdCpl contains whitespace in the prod
environment so the command line parameters are not parsed as expected. In
that case, you can enclose the path in double-quotes:
SET @.CmdCpl = '"' + @.CmdAndPath + @.SqlScript + '"'
If that isn't the problem, try printing the actual @.CmdCpl value and running
from the command line.
Hope this helps.
Dan Guzman
SQL Server MVP
"Coen" <cbusker@.newsgroups.microsoft.com> wrote in message
news:D4DCA3BF-E67B-437C-ADE1-9071EA673BCE@.microsoft.com...
> Hi, can anyone help me with the following xp_cmdshell/osql problem?
> To solve a problem with osql I use the two sql test-scripts. Script1 is
> loaded in Sql Query Analyzer. Executing scripts 1: this calls en execute
> script2, which prints a message to the output window. Quite simple.
> My problem: this is functioning well on a my develop pc (Windows XP-Pro),
> but is not functioning on a production server with Windows 2000 Server
> (SP4).
> On this production machine, recently sql server 2000 SP3 has been
> installed,
> and everything of sqlserver 2000 looks the same as on my develop pc under
> XP-pro. The error reported is about the syntax usage of osql: "usage: osql
> [-U login id] [-P password] [-S server]" and the all the rest of the
> options
> ..... So I should think it has something to do with the used syntax, but
> it
> IS functioning on my develop pc!
> I don't understand why these testscripts do work on my develop pc, and
> don't
> on the production server. I guess it has something to do with either the
> difference in OS, or a setting in the new sql installation on the
> production
> server, but I can't find out the cause.
> ****************************************
**
> Script1.sql:
> DECLARE @.SqlPath sysname, @.SqlScript as sysname, @.Cmd sysname, @.CmdCpl
> nvarchar(400), @.CmdAndPath sysname
> SET @.Cmd = 'osql -S MyServer -d MyDb -Usa -PPwd -i'
> SET @.SqlPath = 'C:\MyPathToScript2'
> SET @.CmdAndPath = @.Cmd + @.SqlPath
> SET @.SqlScript = 'Script2.sql'
> SET @.CmdCpl = @.CmdAndPath + @.SqlScript
> EXEC master..xp_cmdshell @.CmdCpl
> ****************************************
**
> Script2.sql:
> DECLARE @.Test varchar(255)
> SET @.Test = 'Hello world'
> PRINT @.Test
> ****************************************
**
> Any suggestions are welcome,
> Regards Coen.
>|||Dan, thank you for your help. Indeed the problem was caused by whitespaces,
so simple. The double quotes resolved the problem. Thank you for your
assistance.
Regards, Coen
"Dan Guzman" wrote:
> One possible cause is that @.CmdCpl contains whitespace in the prod
> environment so the command line parameters are not parsed as expected. In
> that case, you can enclose the path in double-quotes:
> SET @.CmdCpl = '"' + @.CmdAndPath + @.SqlScript + '"'
> If that isn't the problem, try printing the actual @.CmdCpl value and runni
ng
> from the command line.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Coen" <cbusker@.newsgroups.microsoft.com> wrote in message
> news:D4DCA3BF-E67B-437C-ADE1-9071EA673BCE@.microsoft.com...
>
>sql
Showing posts with label solve. Show all posts
Showing posts with label solve. Show all posts
Thursday, March 22, 2012
Monday, March 19, 2012
error in Reports transfer from access to sql server
Hey,
I Hv been given with upsized adp and mdb. But Reports are not working...
So what could be the problem...
and how culd i solve it.
thxummmm...could you supply just a little more detail?
my usb esp port is clogged|||Sure,,
What i hv been given with are adp and mdb databases...
Now there are some bugs in the adp which wizards do not fixes automatically. So those bugs have to fix by us manually.
The first bug i found is that there is the problem in the reports. The reports after upsizing into sql server are not accessing the data from sql server...
It seems to me that these reports are not connected to sql server some how but application is running good...
I think it may need to change some code but i m unsure that which code...
So plz help..
thx|||Are you getting an error?
What's the data source?
Did all of the tables get qualified with dbo_ in front of them
What do you mean the application is runniong "good"
Can you write a new report and then see what happens?|||When i click on the control in the reports.
It gives me "Invalid Control Propety:Control Source"
and running the application means On the main form i hv some TextBoxes to filled from the database..
and those are good..
but i m having trouble with reports...|||It also says
"No such field in the field list"
I Hv been given with upsized adp and mdb. But Reports are not working...
So what could be the problem...
and how culd i solve it.
thxummmm...could you supply just a little more detail?
my usb esp port is clogged|||Sure,,
What i hv been given with are adp and mdb databases...
Now there are some bugs in the adp which wizards do not fixes automatically. So those bugs have to fix by us manually.
The first bug i found is that there is the problem in the reports. The reports after upsizing into sql server are not accessing the data from sql server...
It seems to me that these reports are not connected to sql server some how but application is running good...
I think it may need to change some code but i m unsure that which code...
So plz help..
thx|||Are you getting an error?
What's the data source?
Did all of the tables get qualified with dbo_ in front of them
What do you mean the application is runniong "good"
Can you write a new report and then see what happens?|||When i click on the control in the reports.
It gives me "Invalid Control Propety:Control Source"
and running the application means On the main form i hv some TextBoxes to filled from the database..
and those are good..
but i m having trouble with reports...|||It also says
"No such field in the field list"
Subscribe to:
Posts (Atom)