xp-cmdshell

MS SQL 2000 - Parameters in DTSRUN using xp_cmdshell

I am running the following: master..xp_cmdshell 'dtsrun /S ricmssql02 /U admindw /P letmein /N "scott - debug"' but also send parameters. I am seeing the following to do that: /A global_parameter_name:typeid=value And also that the whole thing can be repeated to send multiple. My questions are; What is the delimiter for multiple? What a...

Calling stored procedure from web application on UNIX throwing error on xp_cmdshell

Hey all, I'm pulling my hair out on this one. I've checked all my permissions, on both the database server (SQL Server 2000) and the file system to ensure that what I am trying to do should be possible. Here's the situation: I have a Java EE web application running on a Tomcat server on my company's intranet. Long story short, this app...

Copy a file from one dir to another by date

Hi, I have this SQL Job (in SQL Server 2005) that creates a backup every six(6) hours, the backup's filename is based on the timestamp so that it will create a unique filename(dbname_yyyymmddhhmmss.bak), Now my question is, How would I know using xp_cmdshell if the file is three day old and based on my script I want to delete backup(.bak...

CMD Script: How to close the CMD

Hello all, I have created a small command that will let me launch Internet Explorer. However, I wish to close the small command prompt that shows up when I launch IE. How can I do this? This is my current code: "%ProgramFiles%\Internet Explorer\iexplore.exe" http://localhost/test.html PAUSE I am guessing if I take out the Pause. It w...

Reading a text file with SQL Server

I am trying to read in a text file from an SQL query (SQL Server 2005) but am not having any luck at all. I've tried various things with EXEC and xp_cmdshell, but all aren't working. This is the general way I've tried to approach this: CREATE TABLE temp (data varchar(2000)); INSERT temp EXEC master.dbo.xp_cmdshell 'type file.txt'; I ...

Getting execute permission to xp_cmdshell....

I am seeing an error message when trying to execute xp_cmdshell from within a stored procedure. xp_cmdshell is enabled on the instance. And the execute permission was granted to my user, but I am still seeing the exception. The EXECUTE permission was denied on the object ‘xp_cmdshell’, database ‘mssqlsystemresource’, schema ‘sys’ Part...

I'm missing something

declare @servername varchar(2000) set @EmriServerit=(select @@servername) declare @dbname varchar(2000) set @dbname ='Test1' declare @Dir varchar(2000) set @Dir='F:\dataclient.sql' exec master.dbo.xp_cmdshell 'osql -E -S ' + @servername+ ' -d ' + @dbname +' -i ' + @Dir It gives me and error: "incorrect sysntax near +" If i don'...

What is wrong with this recursive Windows CMD script? It won't do Ackermann properly

I'm trying to get to calculate the Ackermann function. A description of what I'm trying to achieve is at http://rosettacode.org/wiki/Ackermann_function. Using the test script, Test 0 4 gives me 5 which is correct. However Test 1 4 gives 5 not 6, and Test 2 4 gives 5 instead of 11. Where am I going wrong? ::echo off set depth=0 :ack i...

Check services at startup of SQL Server

I am trying to check the state of services when SQL Server is started. I am using xp_cmdshell and 'sc query SQLServerAgent | FIND "STATE"' for example to load the output to a global temp table. It works when SQL Server has already started but does not work when the proc is set to autoexec, via sp_procoption. ...

tsql Loop with external query

I am looping through all my databases and aggregating the results into an aggregates database. In my loop I call master.dbo.xp_cmdshell osql C:\whatever.SQL As the loop progresses, the cmdshell takes longer and longer to execute. If I stop the loop and run a single aggregate for one database it executes quickly. Is there anything...