dbTalk Databases Forums  

problem with quation mark

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss problem with quation mark in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
SqlJunkies User
 
Posts: n/a

Default problem with quation mark - 12-14-2004 , 06:00 AM






I have problem with this procedure pleace help!?!?

Server: Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark before the character string 'dtsrun /Sws_1/Usa/P123/Npar/ADynamicFileName:8'.




CREATE PROCEDURE param
(
@myVar char (50)
)
AS

DECLARE @@DtsRunText varchar(64), @@MyVar varchar(70)
SET @@MyVar='DynamicFileName:8+@myVar+'
SET @@DtsRunText = 'EXEC xp_cmdshell ''dtsrun /Sws_1/Usa/P123/Npar/A'+ @@MyVar + ''''

EXEC(@@DtsRunText)
GO


---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: problem with quation mark - 12-14-2004 , 07:40 AM






Several problems I can see. First of all I would add some print statements
to help you diagnose the problem.
I don't understand the use of @@ for variable declarations, and will there
not be some confusion between @myVar and @@MyVar?

@myVar char (50) can lead to a padded string which is probably not what you
want. "Test Var " vs "Test Var".


64 is too short for DECLARE @@DtsRunText varchar(64), so the command line
will get truncated.

SET @@MyVar='DynamicFileName:8+@myVar+' doesn't make sense at all. There
is a variable called @myVar but here it is just treated as part of the
literal, and it does not recognise the parameter.

The lack of any spaces between the parameters is invalid DTSRUN syntax.

Try this as a start point for what you need -

DECLARE @myVar varchar (50)
SET @myVar = 'asdsa'

DECLARE @DtsRunText varchar(1000)

SET @DtsRunText = 'EXEC xp_cmdshell ''dtsrun /Sws_1 /Usa /P123 /Npar /A
"DynamicFileName":"8"="'+ @MyVar + '"'''
PRINT @DtsRunText

EXEC(@DtsRunText)


--
Darren Green
http://www.sqldts.com

"SqlJunkies User" <User@-NOSPAM-SqlJunkies.com> wrote

Quote:
I have problem with this procedure pleace help!?!?

Server: Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark before the character string 'dtsrun
/Sws_1/Usa/P123/Npar/ADynamicFileName:8'.




CREATE PROCEDURE param
(
@myVar char (50)
)
AS

DECLARE @@DtsRunText varchar(64), @@MyVar varchar(70)
SET @@MyVar='DynamicFileName:8+@myVar+'
SET @@DtsRunText = 'EXEC xp_cmdshell ''dtsrun /Sws_1/Usa/P123/Npar/A'+
@@MyVar + ''''

EXEC(@@DtsRunText)
GO


---
Posted using Wimdows.net NntpNews Component -

Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine
supports Post Alerts, Ratings, and Searching.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.