SSIS package execution using DTExec throwing error "set" is not valid - sql-server-2014

Kindly help where i am doing wrong,
E:\Program Files\Microsoft SQL Server\120\DTS\Binn>DTExec /F "D:\SSIS\Import\connection_manager.dtsx" /set "\Package.Variables[User::packagedir].Properties[Value]";"D:\SSIS\Import\\" /set "\Package.Variables[User::PRODDB_connectionstring].Properties[Value]";"Data Source=*********;Initial Catalog=PRODDB;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;Application Name=SSIS;" > "C:\Users\PROD\Desktop\SSIS\log.txt"
Getting Following Error :
Argument
""\Package.Variables[User::PRODDB_connectionstring].Properties[Value];Data
Source=*********;Initial
Catalog=PRODDB;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto
Translate=False;Application Name=SSIS;"" for option "set" is not
valid.

You need to encapsulate your strings with \ before string start. And then you should just write .Value after your parameters instead.
#ECHO OFF
ECHO.
ECHO This is a batch file
ECHO.
DTEXEC.EXE /F "C:\Users\thoje\Documents\Visual Studio 2015\Projects\Integration Services Project8\Integration Services Project8\Package30.dtsx" /set \Package.Variables[User::packagedir].Value;\""D:\SSIS\Import\\"\" /set \Package.Variables[User::conn].Value;\""Data Source=EGC25199;Initial Catalog=LegOgSpass;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False"\"
PAUSE
CLS

Related

Winscp batch file will not run from scheduler

I created a batch file to download a file from a client. I am running windows server 2012. I am using a execute process task in ssis 2014. Both the batch file and my package run fine manually. When I run via the ssis scheduler it gets the following error: Exeute Process Task Error- In Executing C:\Windows\System32\cmd.exe""/C E:\Scripts\Nationwidebatch.bat"at"". the process code was "1" while expected was "0".
#echo off
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\Users\jfrench\AppData\Local\Temp\4\!S.log" /ini=nul ^
/command ^
"open sftp://ecafxxxx:xxxxxxx#tower.nationwide.com/
-hostkey=""ssh-rsa 2048 a6:e9:1a:b0:0d:09:0f:2d:2b:92:82:00:d3:87:9b:36""" ^
"cd /FromNationwide/icafarmb" ^
"option transfer ascii" ^
"get allied.txt \\CFBF-SQL\Insurance\Download\AlliedNW\" ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%
I have run it manually from a batch file, manually from visual studio , and manually from ssis catalog db and they all run successfully. As soon as you add it to the scheduler it dies.

SSIS 2012 Package run through DOS commands

I need to run the SSIS 2012 package through batch file,Package is executing fine in command prompt,But not able to pass parameter run time values via commands ,While run in DOS prompt ,
throwing error like
SET is not recognized as command
"C:\Program Files (x86)\Microsoft SQL Server\120\DTS\ Binn \DTExec.exe" /f "D:\SSIS Deployment\Test Reports\Move Files . dtsx"
/SET \Package. Variables[Report Root Path].Value;"D:\\Development\\PPY"
/SET \Package. Variables[Run Status].Value; "NORM";
I see there are space "Package. Variables"
Just remove the space and try .
remove the last ; and try it again.
this works fine for me:
c:\tmp>dtexec /f "test.dtsx" /SET \Package.Variables[a].Value;"a" /SET \Package.Variables[b].Value;"b"
howerver, this one will give me a similar error:
c:\tmp>dtexec /f "test.dtsx" /SET \Package.Variables[a].Value;"a" /SET \Package.Variables[b].Value;"b";
Argument ""\Package.Variables[b].Value;b;"" for option "set" is not valid.

Pass value to variable in executing SSIS package

I have a SSIS package to loading some data based on the month and I want to call the package via windows batch file. Here is what's in the cmd file which is working fine now:
CD /D C:\Program Files\Microsoft SQL Server\100\DTS\Binn
DTExec.exe /f "E:\APAutomation\SSIS\AP\ActualDataImport_Console_PL.dtsx" /SET \Package.Variables[User::ActualMonth].Properties[Value]; "9"
Now I replace the 9 with a variable so to make it less hardcoded
CD /D C:\Program Files\Microsoft SQL Server\100\DTS\Binn
set ActualMonth = 9
DTExec.exe /f "E:\APAutomation\SSIS\AP\ActualDataImport_Console_PL.dtsx" /SET \Package.Variables[User::ActualMonth].Properties[Value]; "%ActualMonth%"
however, this won't work: this is the error msg:
C:\Program Files\Microsoft SQL Server\100\DTS\Binn>DTExec.exe /f "E:\APAutomatio
n\SSIS\AP\ActualDataImport_Console_PL.dtsx" /SET \Package.Variables[User::Actual
Month].Properties[Value]; ""
Microsoft (R) SQL Server Execute Package Utility
Version 10.50.1600.1 for 64-bit
Copyright (C) Microsoft Corporation 2010. All rights reserved.
Argument ""\Package.Variables[User::ActualMonth].Properties[Value];"" for option
"set" is not valid.
C:\Program Files\Microsoft SQL Server\100\DTS\Binn>pause
Press any key to continue . . .
I also tried:
set ActualMonth = "9"
DTExec.exe /f "E:\APAutomation\SSIS\AP\ActualDataImport_Console_PL.dtsx" /SET \Package.Variables[User::ActualMonth].Properties[Value]; %ActualMonth%
it threw me the same error msg. Pls help!
I think your specific problem is the spaces...
use this
set ActualMonth=9
instead of this:
set ActualMonth = 9
What you're doing is basically setting a package config from a batch file. It might work better if you set up the package to read from a package config file and put your month number in there.

Dynamically set connection string of SSIS package through cmd

I am trying to dynamically set the connection string of my SSIS package through DTEXEC.exe
My CMD file consists of following command.
"C:\Program Files\Microsoft SQL Server\100\DTS\Binn\DTEXEC.exe" /f
"D:\ABC\XYZ\Packages\ABCD.dtsx" /CHECKPOINTING OFF /REPORTING V /CONSOLELOG/Conn
"Configurations;'"Data Source=XXXXXX;Initial Catalog=YYYY;Provider=SQLNCLI10.1;Integrated
Security=SSPI;Auto Translate=False;'"" /SET
"\Package.Variables[User::TargetEnvironmentId].Properties[Value]";"2"
If i take out connection string part it works fine but when i add
/Conn "Configurations;'"Data Source=XXXXXX;Initial Catalog=YYYY;Provider=SQLNCLI10.1;
Integrated Security=SSPI;Auto Translate=False;'""
This it throws exception and says INVALID
Is the name of your connection manager called "Configurations"? I can only assume that is the case. Give the following a try:
/CONNECTION "Configurations";"\"Data Source=XXXX;Initial Catalog=YYYY;Provider=SQLNCLI10.1;Integrated Security=SSPI;Auto Translate=False;\""
I always find it easier to use DTExecUI to create the script, have you tried doing that?
Either that or set the connection string as a variable and pass that through DTExec

How to get CruiseControl.NET working with Mercurial: "Source control failure (GetModifications)"

I'm trying to set up CruiseControl.NET 1.5.7256.1 for automatic builds. My project is stored in Mercurial, and I'm using the following ccnet.config:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<project name="Slider" webURL="http://localhost/ccnet">
<triggers>
<intervalTrigger seconds="3600" />
</triggers>
<sourcecontrol type="hg" autoGetSource="true">
<executable>C:\Python26\Scripts\hg.bat</executable>
<repo>c:\repos\slider</repo>
<workingDirectory>c:\ccnet\slider</workingDirectory>
</sourcecontrol>
<tasks>
<msbuild>
<executable>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe</executable>
<workingDirectory>c:\ccnet\slider</workingDirectory>
<projectFile>Slider.sln</projectFile>
<buildArgs>/noconsolelogger /p:Configuration=Debug /v:diag</buildArgs>
<targets>Slider</targets>
<timeout>900</timeout>
<logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
</msbuild>
</tasks>
</project>
</cruisecontrol>
But when I force a build, I get this error:
[Slider:WARN] Source control failure (GetModifications): Source control operation failed: < was unexpected at this time.
. Process command: C:\Python26\Scripts\hg.bat log -r 0:123 --template <modification><node>{node|short}</node><author>{author|user}</author><date>{date|rfc822date}</date><desc>{desc|escape}</desc><rev>{rev}</rev><email>{author|email|obfuscate}</email><files>{files}</files></modification> --noninteractive
[Slider:INFO] Integration complete: Exception - 12/2/2010 1:19:08 PM
The error is presumably caused by the unquoted angle brackets in the --template parameter, but how can I make CC.NET put quotes around that parameter?
===============
Here's hg.bat:
#echo off
rem Windows Driver script for Mercurial
setlocal
set HG=%~f0
rem Use a full path to Python (relative to this script) as the standard Python
rem install does not put python.exe on the PATH...
rem %~dp0 is the directory of this script
%~dp0..\python "%~dp0hg" %*
endlocal
I'm successfully using CruiseControl.NET 1.5.7256.1 with Mercurial installed from this msi, using full path of hg.exe as the executable value.
In project\core\sourcecontrol\Mercurial\Mercurial.cs the template is used like this:
buffer.AddArgument("--template", HistoryTemplate)
and will be formatted for the command line like this:
string.Format("{0}{1}{2}", arg, separator, StringUtil.AutoDoubleQuoteString(value))
where the separator is " ", and AutoDoubleQuoteString will quote the template, so this can't be the cause of the error.
UPDATE 1
Actually, AutoDoubleQuoteString should quote the template, but in the current version doesn't do it. Also, even if the build succeeds when using hg.exe, running the actual command line in a command prompt returns the same error.
UPDATE 2
CruiseControl.NET 1.6.7981.1 was just released (see release notes), and since the template is now passed as a file, it works just fine (at least on my PC).