473,395 Members | 1,497 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

DTSrun in Stored Procedure

Hi,

I'm writing a stored procedure to run a dts package and I've successfuly
got this working using my sotred proc and the syntax of dtsrun is
correct.

However, I'm trying to pass a variable to the DTSrun command and this is
where I'm having the problem

the code for the proc is:

Declare @partcode nvarchar(255)

EXEC master..xp_cmdshell 'DTSRun /S "server" /U "user" /P "password" /N
"XMLStockCheck" /A "oPartCode":"8"="' + @partcode + '" /W "0" '

Everytime I run it I get this error:

Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '+'.

can someone help me with this please?

M3ckon

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #1
1 11020
You'll to build the command string before executing xp_cmdshell. For
example:

DECLARE @Command varchar(1000)

SET @Command = 'DTSRun /S "server" /U "user" /P "password" /N
"XMLStockCheck" /A "oPartCode":"8"="' + @partcode + '" /W "0" '

EXEC master..xp_cmdshell @Command

--
Hope this helps.

Dan Guzman
SQL Server MVP

"m3ckon" <an*******@devdex.com> wrote in message
news:40*********************@news.frii.net...
Hi,

I'm writing a stored procedure to run a dts package and I've successfuly
got this working using my sotred proc and the syntax of dtsrun is
correct.

However, I'm trying to pass a variable to the DTSrun command and this is
where I'm having the problem

the code for the proc is:

Declare @partcode nvarchar(255)

EXEC master..xp_cmdshell 'DTSRun /S "server" /U "user" /P "password" /N
"XMLStockCheck" /A "oPartCode":"8"="' + @partcode + '" /W "0" '

Everytime I run it I get this error:

Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near '+'.

can someone help me with this please?

M3ckon

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my...
1
by: m3ckon | last post by:
Hi, I'm writing a stored procedure to run a dts package and I've successfuly got this working using my sotred proc and the syntax of dtsrun is correct. However, I'm trying to pass a variable...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
4
by: rockie12 | last post by:
I have a situation where I want to take data from a local sql server 2000 db and update a remote database. I have the sql all set, was wondering if this can be done in a timed interval with a...
3
by: Cesco | last post by:
Hallo to everybody. I have a DTS in SQL Server 2000 and I need to execute it from stored procedure. I know that there are various method fot does this but they doesn't work. The first method that...
8
by: Thomasb | last post by:
With a background in MS SQL Server programming I'm used to temporary tables. Have just started to work with DB2 ver 7 on z/OS and stumbled into the concept of GLOBAL TEMPORARY TABLE. I have...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
3
by: kd | last post by:
Hi All, How to debug a stored procedure? Thanks, kd
2
by: jed | last post by:
I have created this example in sqlexpress ALTER PROCEDURE . @annualtax FLOAT AS BEGIN SELECT begin1,end1,deductedamount,pecentageextra FROM tax
0
by: SOI_0152 | last post by:
Hi all! Happy New Year 2008. Il hope it will bring you love and happyness I'm new on this forum. I wrote a stored procedure on mainframe using DB2 7.1.1 and IBM language c. Everything works...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.