Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Variable String + Variable Expand / Collapse
Author
Message
Posted Tuesday, September 18, 2012 3:42 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 19, 2012 1:33 AM
Points: 5, Visits: 12
I am modifying a script that creates Jobs, is it possible to achieving the following;

@command=N'Some Command' + @ANOTHER_VARIABLE


I need to tag the contents of another variable to then end of one being set.

Can anyone explain how i could achieve this, my real life example is

@command=N'Exec dbo.pReport_Update_Unit ''E:\MyData\Target\CSV''',


I need the Path including single quotes to be passed in by a variable set further up the script, i expected my script to work or look something like below;
e.g.

DECLARE @variable varchar(100)
SET @variable = ''E:\MyData\Target\CSV''
@command=N'Exec dbo.pReport_Update_Unit '+@variable,
Post #1361043
Posted Wednesday, September 19, 2012 1:46 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, October 19, 2012 1:33 AM
Points: 5, Visits: 12
Can anyoen help with this.

Thanks
Post #1361172
Posted Wednesday, September 19, 2012 2:08 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 9:46 AM
Points: 7,224, Visits: 13,696
samtwilliams (9/19/2012)
Can anyoen help with this.

Thanks


DECLARE @variable varchar(100), @command VARCHAR(500)
SET @variable = 'E:\MyData\Target\CSV'
SET @command = N'Exec dbo.pReport_Update_Unit ''' + @variable + ''''
SELECT @command



“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1361183
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse