Execute SQL Task fails when specific column names are mentioned in Excel Query
Hi,
I have a requirement for extracting Excel data with thespecific column order. So instead of using the below query,
Select * From [Sheet1$A1:ZZ1]
I use the below one,
Select col1,
col2,
col91
From [CRM$A1:ZZ1]
So I have totally 91 columns.
I don't face any issues when i use the before query. i.e. direct select * from sheet1
But when i specify column names and do a select from the sheet it throws error as below,
[Execute SQL Task] Error: Executing the query "Select
[Col1]
From [Sheet1$..." failed with the following error: "No value given for one or more required parameters.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not
set correctly, or connection not established correctly.
I just need to retrieve the column name alone and not any of the values to it. So when i do simple select * it gives the column names in the order of what it is been with the excel. But i do want it to be sorted in alphabetically and to retrieve the column
names.
I am not getting any proper solution for this for past 1 and a half days. May anyone of you please help me get it sorted? - Thank you!
--------------------------- Radhai Krish | Golden Age is no more far | --------------------------
Please use something like below:
SELECT F1 AS Col1, F2 AS Col2, F3 AS Col3, ...
FROM [Sheet1$A1:ZZ1]
Cheers,
Vaibhav Chaudhari
[MCTS],
[MCP]
Similar Messages
-
Hi there,
I have this issue with my Execute SQL Task Failing. I am trying to execute a sp using an execute sql task. The execute statement is contained in a variable (exec [sp_name] par1, par2) that I have declared at the package level. Now inside the exec sql
tak, I am calling this variable. Now when I try to execute this task, it fails and I get the following:
[Execute SQL Task] Error: Executing the query "EXEC CTL_ISRT_A 55,1" failed with the following error: "Could not find stored procedure 'CTL_ISRT_A'.". Possible failure reasons: Problems with the query, "ResultSet" property not
set correctly, parameters not set correctly, or connection not established correctly.
There is a stored procedure called "CTL_ISRT_A" in the db and I am able to execute it from SQL Server. This sp is inserting a new row in the table and it returns @@IDENTITY.
I tried setting the result set to a 'Single Row' and tried assigning the value to a variable but it didnt help. Could someone help me here?
Thanks in advancereturn it as an output parameter
ie make sp like below
ALTER PROCEDURE [devdba].[M_CTL_ISRT]
@F_ID INT
, @PR_IND BIT
, @Debug bit = 0
, @IDVal int = 0 OUTPUT
AS
BEGIN
SET NOCOUNT ON
DECLARE @ErrorMsg varchar(5000)
DECLARE @USR_ID AS INT = 1;
INSERT INTO TBL_D (F_ID, PR_IND, USR_ID,CRE_DT, LAST_MODD_USR_ID, LAST_MODD_DT)
VALUES (@F_ID, @PR_IND, @USR_ID, GETDATE(), @USR_ID, GETDATE())
SELECT @IDVal= @@IDENTITY
END
Then in execute sql task call it as
EXEC devdba].[M_CTL_ISRT] ?,?,0,? OUT
then in parameter tab pass required variables and for last parameter make direction as Output and you'll get identify value stored in it.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
SSIS custom execute sql task : Failed with error
I am developing a custom SSIS task for running sql task. But it fails with error - I'm trying to set the resultsetbinding to be used by next task in workflow.
Error: 0xC0014054 at CustomSSISTask: Failed to lock variable "User::id" for read access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container
during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".
Error: 0xC002F210 at CustomSSISTask, Execute SQL Task: Executing the query "SELECT id FROM sysobjects WHERE name = 'sysrowsets..." failed with the following error: "Failed to lock variable "User::id" for read access with error 0xC0010001
"The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is
not being created.".
". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Warning: 0x80019002 at CustomSSISTask: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (3) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches
the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
Task failed: CustomSSISTask
Here is the code sample I'm trying ,
public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser,
IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)
MessageBox.Show("testing:");
try
// Add the SQL Task
Package package = new Package();
package.Executables.Add("STOCK:SQLTask");
Microsoft.SqlServer.Dts.Runtime.Variable variable = package.Variables.Add("id", false, "User", 0);
// Get the task host wrapper
TaskHost taskHost = package.Executables[0] as TaskHost;
// Get the task object
ExecuteSQLTask task = taskHost.InnerObject as ExecuteSQLTask;
// Set core properties
task.Connection = connections[0].Name;
task.SqlStatementSource = "SELECT id FROM sysobjects WHERE name = 'sysrowsets'";
//task.SqlStatementSource =
// "SELECT PersonID from [AmalgaSpeedTableData].[SpeedTable].[DimPerson] where PersonIntID = '1'";
task.SqlStatementSourceType = SqlStatementSourceType.DirectInput;
// Add result set binding, map the id column to variable
IDTSResultBinding resultBinding = task.ResultSetBindings.Add();
//IDTSResultBinding resultBinding = task.ResultSetBindings.GetBinding(0);
resultBinding.ResultName = "variable";
resultBinding.DtsVariableName = variable.QualifiedName; //"User::id";
task.Execute(connections, variableDispenser, componentEvents, log, transaction);
catch (Exception ex)
throw new ArgumentException(ex.Message);
return DTSExecResult.Success;
It doesnt throw any exception but custom task fails.
Later I will be also using parametersetbindings to pass some input parameters to this task , since I'm stuck for out param - blocked moving ahead.
Any help would be greatly appreciated.
Thanks
SangHi, could you check whether the following threads help:
http://stackoverflow.com/questions/5787621/ssis-package-failed-to-locak-variable-for-read-access-with-error-0xc0010001
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/40ee7eff-5ec1-426f-a1a8-ab85b40b51aa/error-variable-can-not-be-found-while-executing-package-from-the-net-code?forum=sqlintegrationservices
Regards, Leo -
Execute SQL Tasks Failing for Duplicate Syntax Between DEV and Production DB
Newbie here...be patient with me!
I added tasks to refresh two tables (delete from, insert into, update) to an SSIS project . I have them running from the WinXP scheduler. The issue:
In dev the tasks integrate and execute successfully from scheduler
In prod I can right click and execute each of the three tasks without any problem, but the same tasks cause my project to fail when executed from scheduler
Questions:
Any ideas about what I am failing to see?
How do I get a meaningful log messages from the tasks that are failing?
Thanks for your ideas...
Installed Edition: IDE Standard
SQL Server Analysis Services
Microsoft SQL Server Analysis Services Designer
Version 9.00.1399.00
SQL Server Integration Services
Microsoft SQL Server Integration Services Designer
Version 9.00.1399.00
SQL Server Reporting Services
Microsoft SQL Server Reporting Services Designers
Version 9.00.1399.00
Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727
Installed Edition: IDE Standard
SQL Server Analysis Services
Microsoft SQL Server Analysis Services Designer
Version 9.00.1399.00
SQL Server Integration Services
Microsoft SQL Server Integration Services Designer
Version 9.00.1399.00
SQL Server Reporting Services
Microsoft SQL Server Reporting Services Designers
Version 9.00.1399.00Newbie here...be patient with me!
I added tasks to refresh two tables (delete from, insert into, update) to an SSIS project . I have them running from the WinXP scheduler. The issue:
In dev the tasks integrate and execute successfully from scheduler
In prod I can right click and execute each of the three tasks without any problem, but the same tasks cause my project to fail when executed from scheduler
Questions:
Any ideas about what I am failing to see?
How do I get a meaningful log messages from the tasks that are failing?
If i understand correctly you are trying to run SSIS package from Window XP task scheduler. The reason for the failure may be due to permission while accessing resources required in the package. However it is difficult to suggest without
looking at the error message.
Scheduled tasks maintains a log file (Schedlgu.txt), in the c:\Windows folder. You can view the log from the Scheduled Tasks window by clicking
View Log on the Advanced menu.
The log file size is 32 kilobytes (KB), and when the file reaches its maximum size, it automatically starts to record new information at the beginning of the log file and writes over the old log file information.
Refer http://support.microsoft.com/kb/308558
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383604(v=vs.85).aspx
Regards, RSingh -
Customized Execute SQL Task in SSIS
Hi,
I,m using Execute SQL Task in SSIS Package with these configuration ..
But, If SQL Statement doesn't report any record mean Query is not returning any data then this Task will be failed.
How can I assure that If there is no record is returning in query that " Execute SQL Task " should bot be executed .
Also I If I can do the same thing through other methods in SSIS, Pls response .
-AshishHi Ashish,
The Execute SQL Task failed because you had set the ResultSet to “Single row”, however, the SQLStatement didn’t return any records. If you don’t want to execute this task when the query doesn’t return any records, you can use the following method:
Create a String type variable RowCnt, add another Execute SQL Task prior to this task.
In the new Execute SQL Task, input the SQLStatement as “Select Count(*) From Table”, set the ResultSet to “Single row”, and map the result set 0 to the variable RowCnt.
Join the two tasks (green line), and edit the Precedence Constraint (Green line), and set the expression to “(DT_I4)@[User::RowCnt]>0”.
Regards,
Mike Yin
TechNet Community Support -
Maintenance Cleanup Task fails when executed with SQL Agent but dont if executed manually
Hello,
I have a job that fails with the following error if exectued via the SQL Server Agent but not if executed manually.
The error is:
Error: 2014-03-31 21:30:14.89 Code: 0xC002F210 Source: Maintenance Cleanup Task Execute SQL Task Description: Executing the query "EXECUTE master.dbo.xp_delete_file 0,N'\\erpfiles\b..."
failed with the following error: "xp_delete_file() returned error 2, 'The system cannot find the file specified.'". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly,
or connection not established correctly. End Error
I have checked and the user configured to run the SQL Agent has all needed accesses to the folder \\erpfiles\b....
Have you an idea to help me go further in my troubleshooting ? Or have you an idea to solve my problem ?
Thanks in advanceI think reason for this is the service account having no permissions on the specified folder path. Thats when you get this error most of the times. The user logged in might have access but please keep in mind that sql agent job makes use of service account
to execute the job which would still need access to the pat to delete the files
What you can do is add a proxy account and give it access to folder path and use it to execute the job
http://www.databasejournal.com/features/mssql/article.php/3789881/Proxy-Accounts-in-SQL-Server.htm
Alternatively you can give the service account access to the folder path.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Hi
DECLARE @XMLA nvarchar(3000)
, @DateSerial nvarchar(35);
-- Change date to format YYYYMMDDHHMMSS
SET @DateSerial = CAST(GETDATE() AS DATE);
--SELECT @DateSerial
Set @XMLA =
N' <Batch xmlns="http://schemas.microsoft.com/analysis services/2003/engine">
<ErrorConfiguration xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2"
xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2" xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200"
xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200">
<KeyErrorLimit>-1</KeyErrorLimit>
<KeyNotFound>IgnoreError</KeyNotFound>
<NullKeyNotAllowed>IgnoreError</NullKeyNotAllowed>
</ErrorConfiguration>
<Parallel>
<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ddl2="http://schemas.microsoft.com/analysisservices/2003/engine/2" xmlns:ddl2_2="http://schemas.microsoft.com/analysisservices/2003/engine/2/2"
xmlns:ddl100_100="http://schemas.microsoft.com/analysisservices/2008/engine/100/100" xmlns:ddl200="http://schemas.microsoft.com/analysisservices/2010/engine/200" xmlns:ddl200_200="http://schemas.microsoft.com/analysisservices/2010/engine/200/200"
xmlns:ddl300="http://schemas.microsoft.com/analysisservices/2011/engine/300" xmlns:ddl300_300="http://schemas.microsoft.com/analysisservices/2011/engine/300/300">
<Object>
<DatabaseID>MultidimensionalProject5</DatabaseID>
<CubeID>giri</CubeID>
<MeasureGroupID>Fact Internet Sales</MeasureGroupID>
</Object>
<Type>ProcessFull</Type>
<WriteBackTableCreation>UseExisting</WriteBackTableCreation>
</Process>
</Parallel>
</Batch>';
EXEC (@XMLA) At SHALL-PCAdventureWorksDw ;
iam executive the query when iam getting below error.
[Execute SQL Task] Error: Executing the query "DECLARE
@XMLA nvarchar(3000)
, @DateSerial nvarch..." failed with the following error: "Incorrect syntax near '-'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set
correctly, or connection not established correctly.
how to solve this error;
please help meWhat are you trying to do? What sort of data source is SHALL-PCAdventureWorksDw?
When you use EXEC() AT, I would execpt to see an SQL string to be passed to EXEC(), but you are passing an XML string????
If you explain why you think this would work in the first place, maybe we can help you.
Erland Sommarskog, SQL Server MVP, [email protected] -
Environment: SQL Server 2008 R2
Code:
CREATE TABLE dbo.PkgAudit
PkgAuditID INT IDENTITY(1, 1),
PackageName VARCHAR(100),
LoadTime DATETIME ,
NumberofRecords VARCHAR(50),
Status1 VARCHAR(50),
Status2 VARCHAR(50),
The following code is inserted in the SQL Task Execute Editor
INSERT INTO dbo.PkgAudit(PackageName
,LoadTime
,NumberofRecords
,Status1
,Status2
) VALUES(?,?,?,?,?)
Screen Shot (Parameter Mapping):
Problem: an error Message occurred when I hit Parse Query Button in the Execute SQL Task Editor, "Execute SQL: Task Editor: The query failed to parse. Syntax error, permission violation, or other nonspecific error". How I could Solve this
problemDifferent connection providers require different Parameter syntax. E.g. ADO @ParameterName notatoin, not just an offset of 0,1 etc.
Arthur My Blog -
I have an package with source , data flow and destination to execute on begin and commit.
in the below i have just used for questioning purpose with diagram removing my Data Flow task explaining my problem
on execution, i get error as
[Execute SQL Task] Error: Executing the query "COMMIT TRAN DimCompanyCode" failed with the following error: "The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.". Possible failure reasons: Problems with the query, "ResultSet"
property not set correctly, parameters not set correctly, or connection not established correctly.
as mentioned , i have checked the ResultSet, parameters , connection establish.. all are fine.
Kindly advice on what has to be done.
ShanmugaRajTo avoid this error, the RetainSameConnection property should set to 'True' for the Connection Manager - Application_DB.
Narsimha -
I executed a simple query inside an execute SQL task -
SELECT col1, col2
from thetable
where code = ?
order by id asc
Exec sql task - ADO.NET connection
parameter "code" is an int32 in SSIS and int32 in parameter mapping of exec sql task.
It works fine in SQL server, but in SSIS it causes the error -
[Execute SQL Task] Error: Executing the query "SELECT col1, col2
from thet..." failed with the following error: "Failed to create an IDataAdapter object. This provider may not be fully supported with the Execute SQL Task. Error message 'Incorrect syntax near '?'.'.". Possible failure reasons: Problems with
the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
How do I fix this error ?Thanks. I think it was sqlclient. I changed it to OLEDB to avoid that issue. Btw, what is this "provider" ?
Hi blastoSO,
To check which provider is used by the current ADO.NET Connection Manager, you can open the “Configure ADO.NET Connection Manager” window, and check the “Managed Provider” option of each Data connection.
In an Execute SQL Task, if the managed provider is “System.Data.SqlClient”, we should use the rule for the ADO.NET connection type in the following table. If the managed provider is “System.Data.Oledb” or “System.Data.Odbc”, it actually uses the OLE DB provider
or ODBC provider, so we should use the rule for the OLE DB or OBC rule in the following table:
Reference:
http://technet.microsoft.com/en-us/library/cc280502.aspx
Regards,
Mike Yin
TechNet Community Support -
Why is my Package just stopping when going from one Execute SQL Task to another Execute SQL Task
I have one flow constraint going for my one Execute SQL Task to another Execute SQL Task. It's executing #1 and successfully and just stops there rather than continuing on to Execute SQL Task #2. Why would it just stop? My constraint is NOT conditional...just
a straight ole flow constraint.
Any help is greatly appreciated and Thanks in Advance for your help.
PSULionRPHi PSULionRP,
First make sure the color of the Precedence Constraint is green (Success) or blue (Completion) other than red (Failure). Then, make sure the Execute SQL Task is not disabled (right click the executable, and “Disable” option is available in the right-click
menu).
Regards,
Mike Yin
TechNet Community Support -
Passing the same input parameter twise in execute sql task
Hi All, I want to insert some values to 3 different tables in sql server. Execute sql task is used to populate three tables. Here is the sql statement.
DECLARE @Dt AS DATE
SET @Dt = ?
INSERT INTO TABLE1 SELECT ?, COL2, COL3 FROM TABLE_A
INSERT INTO TABLE2 SELECT ?, COL2, COL3 FROM TABLE_B
Input parameter is mapped as follows :
Variable name : User::EffectiveDate
Direction : Input Data Type :
Date Parameter name :0
Parameter size :-1
User::EffectiveDate is datetime variable.
When the package is executed, it throws an error.
[Execute SQL Task] Error: Executing the query " " failed with the following error: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.". Possible failure reasons: Problems
with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. I am not sure what I am doing wrong here. If anyone could point me to the right direction, I really appreciate.
Thanks
shamenTo expand on the other answers.
Your SQL command
DECLARE @Dt AS DATE
SET @Dt = ?
INSERT INTO TABLE1 SELECT ?, COL2, COL3 FROM TABLE_A
INSERT INTO TABLE2 SELECT ?, COL2, COL3 FROM TABLE_B
It using 3 input variables. I assume you didn't pass 3 variables and you want @DT to be column 1 in each. In that case you would use:
DECLARE @Dt AS DATE
SET @Dt = ?
INSERT INTO TABLE1 SELECT @Dt, COL2, COL3 FROM TABLE_A
INSERT INTO TABLE2 SELECT @Dt, COL2, COL3 FROM TABLE_B -
Execute SQl Task Error SSIS Package
Hi all,
I`m using for each loop container in my package to grab the file name from the source path. I have created 2 vairables
FilePath and SourceFolder
I`m using execute sql task inside the container and this is my query
Insert into [dbo].[DCA_FF_TEST] (File_Name,File_Date) SELECT File_name = ?,
File_Date = GetDate()
Please not the Table I am trying to insert has more columns but at this stage I dont need them.
When i execute the task I get an error
[Execute SQL Task] Error: Executing the query "
INSERT INTO [dbo].[DCA_FF_TEST] ([File_Name],[F..." failed with the following error: "The statement has been terminated.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters
not set correctly, or connection not established correctly.
Can someone point me in the right direction? Am I missing anything?
Resultset property Set to None
Parameter Mapping: Variablename: FilePath , Direction: Input, datatype : Varchar, Parametername: 0, ParameterSize: 100.
I`ve checked the connection as well it works.
FMDid you try
Insert into [dbo].[DCA_FF_TEST] (File_Name,File_Date)
SELECT ?, GetDate()
Or
Insert into [dbo].[DCA_FF_TEST] (File_Name,File_Date) VALUES (?, GetDate())
A Fan of SSIS, SSRS and SSAS -
Using Union in Execute SQL Task
I am using the following SQL statement in an Excute SQL Task:
declare @RespAreaSubAreaID int, @UserLevelID int, @SubmittedByUserID int, @RespAreaID int, @SubAreaID int
Set @RespAreaSubAreaID = ?
Set @SubmittedByUserID = ?
Set @UserLevelID = ?
set @RespAreaID = ?
set @SubAreaID = ?
select users.User_EmailAddress + ';' As CC
from users inner join UserLevelsNotificationFrequencys on users.user_Id = UserLevelsNotificationFrequencys.User_id
where UserLevelID = @UserLevelID and RespAreaSubAreaID = @RespAreaSubAreaID and (NotificationFrequencyID = 4 and users.user_id <> @SubmittedByUserID)
union
select users.User_EmailAddress + ',' As CC
from users inner join UserLevelsNotificationFrequencys on users.user_Id = UserLevelsNotificationFrequencys.User_id
where UserLevelID = @UserLevelID and RespAreaSubAreaID = @RespAreaSubAreaID and (NotificationFrequencyID = 1)
I have my parameter mapped correctly. My results set is set to xml because I want it all in one string to use as a variable named User:CC. On the Result Set tab the result name is 0 and the variable name is User:CC. When I run my package I am getting
the error below. Can I not do a union query in the execute SQL task? I tried to not declare anything and just map to each of the variables that I am passing in the order that they are needed but that didn't work either. Thanks in advance for your help in this
matter.
[Execute SQL Task] Error: Executing the query "declare @RespAreaSubAreaID int, @NotificationID
in..." failed with the following error: "Syntax error, permission violation, or other nonspecific error". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection
not established correctly.
Reach for the unknown!Thank you for your reply but I am not using the Data Flow. All my work is happening on the Control Flow. I am looping through a set of records and emailing them to the correct
people. Setting my result set to XML worked for the To Line (See my earlier post Execute SQL task for Email ToLine using COALESCE and two variables) and now I am working on the CC line which is more complicated because it uses a union statement.
Reach for the unknown! -
Combining package configuration and Execute SQL task at run time
Hi everyone,
I have an issue regarding setting values at run time
I use package configuration to manage different enviroments scenarios (DEV, PROD):
XML file to store the connections string of SSISConfigDB
and the actual values of parameters in that SSISConfig DB tables Filtered by ConfigurationFilter column
Now, one of my packages needs in addition setting at run time value of a flat file name
i used an Execute SQL task - within the task i read into a variable the file name using command line
then, the full path of Flat File Connection is set by expression concatenating the root folder and the variable
the problem is that the variable stays empy! as if the Execute SQL task was never executed!
Am i doing something incorrect? in the package configuration wizard the configured value are only XML file and the connection string of the DB.
to summerize - how can i combine package configuration, default value, Execute SQL task and expression at runtime?1.EvaluateasExpression=TRUE (Full Path variable)
2. Do you mean to invlole a ISNULL() function in the expression? if so, no
3. Of course i recieve a valid value
4. The Full path expression is evaluated to the root folder - without the portion of the file name
here is the syntax in Execute SQL Task:
truncate table OnErrorFlagTable
Declare @Path varchar(128)
Declare @FileName varchar(128)
Declare @SenderID varchar(5)
Declare @INST_COD varchar(5)
Declare @Flag int = 0
Declare @FileType varchar(2)='01'
Truncate table TraumaRecords
Select @Path = 'C:\RootFolder\'
--***Insert into Temp table the file so we can take his name***--
Create Table #Tmp(Txt Varchar(Max))
Insert Into #Tmp(Txt)
Exec master..xp_cmdshell 'Dir *.txt C:\RootFolder\/b'
select top 1 @Filename = Txt From #Tmp
Where ISNUMERIC(substring(Txt,1,1))=1
order by Txt desc
Insert into OnErrorFlagTable
Select 2,@FileName
Select @FileName as TraumaFileName,@FileType as FileType
Then, in ResultSet TraumaFileName and FileType are mapped
Expression of @TraumaFlatfileFullPath is
@[User::TraumaFlatfilePath]+ @[User::TraumaFlatFileName]
where the variable @[User::TraumaFlatfilePath] is evaluated in variable window (default value)
and it's value is C:\RootFolder\
and @[User::TraumaFlatFileName] is the ResultSet of the ExecuteSQLTask
and for some reason when executed in SSIS return null while in SSMS return the expected value
Can you try making this into a procedure with required parameters and call it from SQL task to see if you get return value correctly? Use OUTPUT parameters for getting back required values
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Maybe you are looking for
-
How do i disable a stop button within an event
Using LabView 8.6 I'd like to disable my vi's stop button so the user can't stop the vi unless the network application is in the correct mode of operation. I only want the user to be able to stop the vi when it is ok to do so. What I tried works to p
-
Printer connected to Airport Express only works on OSX Partition, not Windows 7 Partition
I have a mid 2012 Macbook Pro, 13 inch with 2.9ghz processor and 8GB RAM that has a Boot Camp partition on it running Windows 7 Professional. I have had an Airport Express base station that I purchased in 2013, and have a printer connected to it, a H
-
Safari 3.0.4 now crashes upon browsing to any site
I have Leopard on a Mac Pro and am using Safari 3.0.4. Over the last couple of days, whenever I go to a site, I get the following crash: Process: Safari [8331] Path: /Applications/Safari.app/Contents/MacOS/Safari Identifier: com.apple.Safari Version:
-
Hi , I have a date in this format Apr 11,2002 . I would like to convert it to 4/11/02 and vice versa. Can anyone give a hand on this. thanks
-
HT201303 I can't find the none option in my Apple ID I don't want to put in my credit card
I need help