Showing posts with label xp_cmdshell. Show all posts
Showing posts with label xp_cmdshell. Show all posts

Friday, March 9, 2012

Error xp_cmdshell

I'm having the hardest problem. My input values are of datetime and the cha
racter string that I'm creating is giving me an error saying can't convert d
atetime to char. Is what I'm trying to do possible?
Thanks in advance for your help.
set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtri
m(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where
b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (th
is is a date time value) be
tween ' + (date time value) + ' and ' + end date time value + ''', no_output
'
Because @.dcmd is of varchar and the parms that I'm trying to send it is date
time nothing seems to work. I can't even put quotes around it because it r
efuses to run without it.You have to explictly convert your 2 parameters into a character format
using the CONVERT function if you want to get them into the string.
Herbert
"D" <D@.discussions.microsoft.com> schrieb im Newsbeitrag
news:0B41DF21-B79F-495A-8FE7-6BE5A484FAB4@.microsoft.com...
> I'm having the hardest problem. My input values are of datetime and the
character string that I'm creating is giving me an error saying can't
convert datetime to char. Is what I'm trying to do possible?
> Thanks in advance for your help.
> set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' +
rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m
where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and
date (this is a date time value) between ' + (date time value) + ' and ' +
end date time value + ''', no_output'
> Because @.dcmd is of varchar and the parms that I'm trying to send it is
date time nothing seems to work. I can't even put quotes around it because
it refuses to run without it.|||You only need to post this question once.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
D wrote:
> I'm having the hardest problem. My input values are of datetime and the c
haracter string that I'm creating is giving me an error saying can't convert
datetime to char. Is what I'm trying to do possible?
> Thanks in advance for your help.
> set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd
) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1
= m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time valu
e)
between ' + (date time value) + ' and ' + end date time value + ''', no_output'en">
> Because @.dcmd is of varchar and the parms that I'm trying to send it is date time
nothing seems to work. I can't even put quotes around it because it refuses to run
without it.

Error xp_cmdshell

I'm having the hardest problem. My input values are of datetime and the character string that I'm creating is giving me an error saying can't convert datetime to char. Is what I'm trying to do possible?
Thanks in advance for your help.
set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time value) between ' + (date time value) + ' and ' + end date time value + ''', no_output'
Because @.dcmd is of varchar and the parms that I'm trying to send it is date time nothing seems to work. I can't even put quotes around it because it refuses to run without it.You have to explictly convert your 2 parameters into a character format
using the CONVERT function if you want to get them into the string.
Herbert
"D" <D@.discussions.microsoft.com> schrieb im Newsbeitrag
news:0B41DF21-B79F-495A-8FE7-6BE5A484FAB4@.microsoft.com...
> I'm having the hardest problem. My input values are of datetime and the
character string that I'm creating is giving me an error saying can't
convert datetime to char. Is what I'm trying to do possible?
> Thanks in advance for your help.
> set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' +
rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m
where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and
date (this is a date time value) between ' + (date time value) + ' and ' +
end date time value + ''', no_output'
> Because @.dcmd is of varchar and the parms that I'm trying to send it is
date time nothing seems to work. I can't even put quotes around it because
it refuses to run without it.|||You only need to post this question once.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
D wrote:
> I'm having the hardest problem. My input values are of datetime and the character string that I'm creating is giving me an error saying can't convert datetime to char. Is what I'm trying to do possible?
> Thanks in advance for your help.
> set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time value) between ' + (date time value) + ' and ' + end date time value + ''', no_output'
> Because @.dcmd is of varchar and the parms that I'm trying to send it is date time nothing seems to work. I can't even put quotes around it because it refuses to run without it.

Error xp_cmdshell

I'm having the hardest problem. My input values are of datetime and the character string that I'm creating is giving me an error saying can't convert datetime to char. Is what I'm trying to do possible?
Thanks in advance for your help.
set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time value) be
tween ' + (date time value) + ' and ' + end date time value + ''', no_output'
Because @.dcmd is of varchar and the parms that I'm trying to send it is date time nothing seems to work. I can't even put quotes around it because it refuses to run without it.
You have to explictly convert your 2 parameters into a character format
using the CONVERT function if you want to get them into the string.
Herbert
"D" <D@.discussions.microsoft.com> schrieb im Newsbeitrag
news:0B41DF21-B79F-495A-8FE7-6BE5A484FAB4@.microsoft.com...
> I'm having the hardest problem. My input values are of datetime and the
character string that I'm creating is giving me an error saying can't
convert datetime to char. Is what I'm trying to do possible?
> Thanks in advance for your help.
> set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' +
rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m
where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and
date (this is a date time value) between ' + (date time value) + ' and ' +
end date time value + ''', no_output'
> Because @.dcmd is of varchar and the parms that I'm trying to send it is
date time nothing seems to work. I can't even put quotes around it because
it refuses to run without it.
|||You only need to post this question once.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
D wrote:
> I'm having the hardest problem. My input values are of datetime and the character string that I'm creating is giving me an error saying can't convert datetime to char. Is what I'm trying to do possible?
> Thanks in advance for your help.
> set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time value)
between ' + (date time value) + ' and ' + end date time value + ''', no_output'
> Because @.dcmd is of varchar and the parms that I'm trying to send it is date time nothing seems to work. I can't even put quotes around it because it refuses to run without it.

Error with xp_cmdshell command

I'm having the hardest problem. My input values are of datetime and the cha
racter string that I'm creating is giving me an error saying can't convert d
atetime to char. Is what I'm trying to do possible?
Thanks in advance for your help.
set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtri
m(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where
b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (th
is is a date time value) be
tween ' + (date time value) + ' and ' + end date time value + ''', no_output
'
Because @.dcmd is of varchar and the parms that I'm trying to send it is date
time nothing seems to work. I can't even put quotes around it because it r
efuses to run without it.You only need to post this question once.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
D wrote:
> I'm having the hardest problem. My input values are of datetime and the c
haracter string that I'm creating is giving me an error saying can't convert
datetime to char. Is what I'm trying to do possible?
> Thanks in advance for your help.
> set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd
) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1
= m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time valu
e)
between ' + (date time value) + ' and ' + end date time value + ''', no_output'en">
> Because @.dcmd is of varchar and the parms that I'm trying to send it is date time
nothing seems to work. I can't even put quotes around it because it refuses to run
without it.

Error with xp_cmdshell command

I'm having the hardest problem. My input values are of datetime and the character string that I'm creating is giving me an error saying can't convert datetime to char. Is what I'm trying to do possible?
Thanks in advance for your help.
set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time value) between ' + (date time value) + ' and ' + end date time value + ''', no_output'
Because @.dcmd is of varchar and the parms that I'm trying to send it is date time nothing seems to work. I can't even put quotes around it because it refuses to run without it.You only need to post this question once.
--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
D wrote:
> I'm having the hardest problem. My input values are of datetime and the character string that I'm creating is giving me an error saying can't convert datetime to char. Is what I'm trying to do possible?
> Thanks in advance for your help.
> set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time value) between ' + (date time value) + ' and ' + end date time value + ''', no_output'
> Because @.dcmd is of varchar and the parms that I'm trying to send it is date time nothing seems to work. I can't even put quotes around it because it refuses to run without it.

Error with xp_cmdshell command

I'm having the hardest problem. My input values are of datetime and the character string that I'm creating is giving me an error saying can't convert datetime to char. Is what I'm trying to do possible?
Thanks in advance for your help.
set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time value) be
tween ' + (date time value) + ' and ' + end date time value + ''', no_output'
Because @.dcmd is of varchar and the parms that I'm trying to send it is date time nothing seems to work. I can't even put quotes around it because it refuses to run without it.
You only need to post this question once.
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
D wrote:
> I'm having the hardest problem. My input values are of datetime and the character string that I'm creating is giving me an error saying can't convert datetime to char. Is what I'm trying to do possible?
> Thanks in advance for your help.
> set @.dcmd = 'exec master.dbo.xp_cmdshell ''osql -Sservername -E -o ' + rtrim(@.cmd) + ' -Q" set nocount off;select * from table_one b, table_two m where b.table_one_1 = m.table_two_2 and b.table_one_1= m.table_two_2 and date (this is a date time value)
between ' + (date time value) + ' and ' + end date time value + ''', no_output'
> Because @.dcmd is of varchar and the parms that I'm trying to send it is date time nothing seems to work. I can't even put quotes around it because it refuses to run without it.

Sunday, February 19, 2012

Error while running xp_cmdshell

I am getting the following error when running a command in Query
Analyzer.

Msg 50001, Level 1, State 50001
xpsql.cpp: Error 5 from CreateProcess on line 675

Here is the command that I am running that generates this error
message:

xp_cmdshell "@.ECHO test message > c:\temp\newtemp.txt"

The command inside the xp_cmdshell command runs successfully from a
Windows command prompt. Simpler commands also fail with the same error
message. For example:

xp_cmdshell 'dir'

Can anyone suggest a solution to this problem? I assume this problem is
due to a permissions/security issue. I have given Everyone Full Control
over c:\temp.

Windows 2000
SQL Server 2000

Thanks for any help.Probably a permissions issue.

Best way to troubleshoot this is as follows:

1. Log in as "sa" or as a sysadmin user (you are already doing this
step right?)
2. Try running the xp_cmdshell (does it work?)
3. If no, check the startup account for the MSSQLSERVER service - does
this user have the ability to run this command? Not sure? Log off the
server and log back in as this service startup user.. Try running the
DOS command...

The key is to make sure the account running the SQL Server service has
the p|||Chris Allison (chris.f.allison@.gmail.com) writes:
> I am getting the following error when running a command in Query
> Analyzer.
> Msg 50001, Level 1, State 50001
> xpsql.cpp: Error 5 from CreateProcess on line 675
> Here is the command that I am running that generates this error
> message:
> xp_cmdshell "@.ECHO test message > c:\temp\newtemp.txt"
> The command inside the xp_cmdshell command runs successfully from a
> Windows command prompt. Simpler commands also fail with the same error
> message. For example:
> xp_cmdshell 'dir'

And what does "xp_cmdshell 'set'" yield? That is, a command that
does not perform any disc access at all?

"NET HELPMSG 5" gives "Access is denied", but I'm too bad at Windows
to say what access it is. Since this happens in CreateProcess one
could suspect that access is denied when try to create a subprocess.

Under which user does SQL Server run? And are yourself logged into
SQL Server as sysadmin, or as an unpriviledged user?

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Hi, the xp_cmdshell stored procedure needs grants in cmd.exe

go to %systemroot%\system32\cmd.exe right click, and add grants.

It is not recommended by security reasons.
regards

Sha0
www.badchecksum.com|||One simple answer:

Antivirus software!

It could be any of the solutions suggested on the internet when searching for "Error 5 from CreateProcess" on Google, but I tried them all and none of them helped.

I uninstalled the antivirus software (Panda) and it worked like a charm!

Try uninstalling (or configuring) your antivirus software.

Kind regards, good luck and may the source be with you

/Boozon

Error While Running Dts

Hi,
I am trying to run a DTS from SP. The SQL code that I am using is as follows.......

exec master..xp_cmdshell 'dtsrun /S 142.102.27.207 /U sa /P sa /N DTS_TEST1'

But Running this I am getting the the following errror......
DTSRun: Loading...
DTSRun: Executing...
DTSRun OnStart: DTSStep_DTSDataPumpTask_1
DTSRun OnError: DTSStep_DTSDataPumpTask_1, Error = -2147467259 (80004005)
Error string: Error opening datafile: The system cannot find the path specified.
Error source: Microsoft Data Transformation Services Flat File Rowset Provider
Help file: DTSFFile.hlp
Help context: 0

Error Detail Records:
Error: 3 (3); Provider Error: 3 (3)
Error string: Error opening datafile: The system cannot find the path specified.
Error source: Microsoft Data Transformation Services Flat File Rowset Provider

Help file: DTSFFile.hlp
Help context: 0

DTSRun OnFinish: DTSStep_DTSDataPumpTask_1
DTSRun: Package execution complete.

NULLGuys......... Help me in this regard..............|||Is the SQL Instance your connecting to (142.102.27.207) local (the same server where you're running DTSRun)?

Also it's running from the context of the windows-account that's running SQL Server. Is that account allowed to access the file?|||The SqlServer Computer has been given the full control to the file where the data is to be transferred in the application server through DTS.|||where as when I am running from the command prompt of the application server, its running successfully...............

dtsrun /S 142.102.27.207 /U sa /P sa /N DTS_TEST1

NOTE:
SQLSERVER: 142.102.27.207
APPLICATION SERVER: 142.102.27.154

I have a folder named "TEST" in the application server, where i have given the "full control" to 142.102.27.207 (DB Server). Folder Test is having an excel file which is the destination object for the DTS. DTS is transferring teh data from a table to this excel file.|||it is definitly security related. Does the account running the sql server agent and sql server service have full control on test?