Quantcast
Viewing all 24688 articles
Browse latest View live

How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?

Hi 

I have a stored procedure. It can be executed like this

exec test @p = 1;

exec test @p = 2

exec test @p = n;

n can be hundred.

I want the sp being executed in parallel, not sequence. It means the 3 examples above can be run at the same time.

If I know the number in advance, say 3, I can create 3 different Execution SQL Tasks. They can be run in parallel.

However, the n is not static. It is coming from a table. 

How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?

I think about using script task. In the script, I get the value of n, and the list of p, from the table, then running a loop with. In the loop, I create a threat and in the threat, I execute the sp like : exec test @p = p. So the exec test may be run parallel. But I am not sure if it works.

Any idea is really appreciated.


VARCHAR(MAX) to Oracle CLOB with Attunity 3.0 and SSIS 2014 Enterprise oracle 11.2.0.3.0

SQL Server 2014 Enterprise 12.0.2370 to Oracle 11.2.0.3.0

SSIS Developed on VS2013 sql data tools. 64 bit win2k12 R2 workstation with Oracle 32 and 64 bit dlls and Attunity 3.0 32 and 64 bit drivers for SSIS Oracle.

I can successfully define my sql data source and my oracle destination. One of the fields in the SQL Server source is varchar(max). Some of the records have 32,000+ characters.

when i map the varchar(max) column to the CLOB oracle column i get no errors. i save the project and come back and the source column in the mapping in the destination definition is set to IGNORE. No matter what i do it does this. I run the package and it exports all of the columns except the varchar(max) column. Compiling and running the project in VS2013 gives no errors.

It was my understanding that at one time Attunity did not support CLOB but starting with version 2.0 and SQL Server 2012 Enterprise, the field type was supported.

Any help on this one is greatly appreciated.

Loop Excel to SQL that it doesn't work

I am getting crazy guys, situation:

ForEachLoop Container in order to load excel file.

Image may be NSFW.
Clik here to view.

Data Flow with all the setting:

Image may be NSFW.
Clik here to view.

If I run the data flow single it orks, but if I run the Container it returns:

[Excel Source [1]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Excel Connection Manager 1" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.

[SSIS.Pipeline] Error: component "Excel Source" (1) failed validation and returned error code 0xC020801C.

What's wrong? With the csv file is so easy, why Excel vs SSIS is always so grumpy?

SSIS packages from DEV to PROD

I have created multiple SSIS packages on my DEV machine using a local SQL Server instance and Windows Authentication.

When moving to production, I will need to update the Connection Manager details to point to our PROD SQL Server instance.

When I do this, will I have to manually update each of the source and destination managers used in the package?

SSIS 2012: What rights are needed to connect to SSDB via DMO

I'm trying to connect to the SSDB catalog to execute a package using the .NET object model as per http://social.technet.microsoft.com/wiki/contents/articles/21978.execute-ssis-2012-package-with-parameters-via-net.aspx?CommentPosted=true#commentmessage

The problem is if I do this with a normal user I get

   The server principal "XXXX"isnot able to access thedatabase\"SSISDB\" under thecurrent security context.

If I grant the user sysadmin rights it works, but the old Integration Services model of granting db_ssisadmin doesn't help


Paul

Convert SQL Query to Derived Column Expression

I'm in the process of reworking some SSIS packages I inherited. A lot of these use Execute SQL Statement components to update certain fields in the tables once they've been loaded. I'd like to replace these individual UPDATE statements with Derived Column components.

I've got 95% of them converted, except for a couple, one of which has me a bit perplexed and was hoping someone could provide some insight.

Essentially, there is a column called POSTPERIOD which is a date in string format YYYYMM (i.e., 201503). The SQL update parses out the month piece and converts it to the month name and populates a column called POSTPERIOD_MONTH.

Here is the SQL:

select    DateName(month , DateAdd(month, CONVERT(INT, SUBSTRING(POST_PERIOD,5,2)), 0 ) - 1 )

I'd like to accomplish this using a Derived Column, but not sure how to go about doing this...

If someone could point me in the right direction, it would be greatly appreciated!

Thanks!


A. M. Robinson

The package failed to load due to error 0xC0010014

Hello,

I've developed an SSIS package on my local XP machine. Basically just to import a flat file (pipe delimited) and insert the records into a database.

However, when I tried to open/execute it on Windows Server 2008 64-bit running SQL Server 2005 SP2 Enterprise 64-bit, I'm getting exception errors.

I'm getting the following exception error:

===================================

The package failed to load due to error 0xC0010014 "One or more error occurred. There should be more specific errors preceding this one that explains the details of the errors. This message is used as a return value from functions that encounter errors.". This occurs when CPackage::LoadFromXML fails.
 (AX_Upload_Inventory)

------------------------------
Program Location:

   at Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage(String fileName, IDTSEvents events, Boolean loadNeutral)
   at Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage(String fileName, IDTSEvents events)
   at Microsoft.DataTransformationServices.Controls.PackageProtectionUtils.<>c__DisplayClass4.<LoadPackageFromFile>b__3(String password, IDTSEvents events)
   at Microsoft.DataTransformationServices.Controls.PackageProtectionUtils.LoadPackageWithPassword(PackageLoader loader, IWin32Window dialogParent, String& packagePassword)
   at Microsoft.DataTransformationServices.Controls.PackageProtectionUtils.LoadPackageFromFile(String file, IWin32Window dialogParent, String& packagePassword)
   at Microsoft.DataTransformationServices.Controls.PackageLocationControl.LoadPackage(String& packagePassword)
   at Microsoft.SqlServer.Dts.ObjectExplorerUI.ImportPackageAsAction.ImportPackage(ImportPackageAsForm dlg)

===================================

The package failed to load due to error 0xC0010014 "One or more error occurred. There should be more specific errors preceding this one that explains the details of the errors. This message is used as a return value from functions that encounter errors.". This occurs when CPackage::LoadFromXML fails.
 (AX_Upload_Inventory)

------------------------------
Program Location:

   at Microsoft.SqlServer.Dts.Runtime.Wrapper.ApplicationClass.LoadPackage(String FileName, Boolean loadNeutral, IDTSEvents90 pEvents)
   at Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage(String fileName, IDTSEvents events, Boolean loadNeutral)
===================================

I've tried executing the package using dtexec, try to intsall the package from its deployment kit and try importing the package but all of them are throwing the same exception error. The package do not have any password assigned to it as well. A few more screen shots of the error I'm getting is shown here: http://i43.tinypic.com/2ai1m3m.png

Would greatly appreciate any help on this one.
Thank you very much.

Cheers!

migration from sqlserver 2005 to 2012

Hi Friends,

As we migrating our sqlserver database from 2005 to 2012, copy and attach sqlserver 2005 to 2012 database which is optimized way, or we should export data rows by table in new server is best way or just copy from sqlserver 2005 to attached to sqlserver 2012 and change backup compbality parameter.

thank you.

regards,

asad


asad


SSIS Dynamic Columns in SQL

Hi All

I have an unusual issue and wondered if someone could assist. have a table which contains a list of columns which i need to feed into the query. I have written some dynamic SQL as shown:

Declare @KeyString varchar(100)

Declare @SQL1 nvarchar(max)

Set @KeyString=(Select STUFF((SELECT '+' + Attr FROM ave_control.ETL.Source inner JOIN [DM_AVE2].[Reference].[CRKAttr] on client = sourcename COLLATE DATABASE_DEFAULT where Client = 'Brampton' Order by AttrOrder FOR XML PATH('')),1,1,'') AS KeyString)
;
Set @SQL1 ='WITH CLAIMDATA AS(
				Select
				DB_NAME() AS DBName,
				Convert(Varchar,UK.KMPONO) + ''/'' + Convert(Varchar,UK.KMPOSQ) + ''/'' + Convert(Varchar,UK.KMUGYR) + ''/'' + Convert(Varchar,UK.KMDANO) AS [POLICYREF],
				Convert(Varchar,UK.KMPONO) + ''/'' + Convert(Varchar,UK.KMPOSQ) + ''/'' + Convert(Varchar,UK.KMUGYR) + ''/'' + Convert(Varchar,UK.KMDANO) + ''/'' + CONVERT(VarChar,UK.KMCMSQ) AS [CLAIMREF],
				left(19000000+KMLODT,4) as [LOSSYEAR],
				UK.KMLOCD AS [LOSSCODE],
				CASE WHEN KMLOCD = '''' then COALESCE(UC.LOLODS,'''') ELSE UC.LOLODS END AS LOSSDESCRIPTION,
				UK.KMEVCD AS [EVENTCODE],
				KMCMDS AS [CLAIMDESCRIPTION],
				CASE WHEN LEFT(KMCMDS,1) = ''@'' THEN ''Y'' ELSE ''N'' END AS [STATICRESERVEREVIEW],
				CASE WHEN UCE.EVEVDS IS NULL then COALESCE(UCE.EVEVDS,'''') ELSE UCE.EVEVDS END AS [EVENTCODEDESCRIPTION]
				FROM UKKMREP UK
				LEFT JOIN UCLOREP UC ON UK.KMLOCD = UC.LOLOCD
				LEFT JOIN UCEVREP UCE ON UK.KMEVCD = UCE.EVEVCD),
	COGDATA AS(
				SELECT TOP 100 PERCENT
				CONVERT(Varchar,POLICY)+''/''+CONVERT(Varchar,CO.SEQ)+''/''+CONVERT(Varchar,CO.[YEAR])+''/''+CONVERT(Varchar,CO.[DEC])+''/''+CONVERT(Varchar,CO.CLAIM) AS [CLAIMREF],
				[Type],
				SUM(isnull(CO.KCR,0)+isnull(CO.ACR,0)+isnull(CO.[OCR],0)+isnull(CO.[EXP],0)+isnull(Co.[LOC],0)) AS OLR
				FROM COG626A CO
				Group by CONVERT(Varchar,POLICY)+''/''+CONVERT(Varchar,CO.SEQ)+''/''+CONVERT(Varchar,CO.[YEAR])+''/''+CONVERT(Varchar,CO.[DEC])+''/''+CONVERT(Varchar,CO.CLAIM), [Type]
				ORDER BY CLAIMREF

				),
	CLAIMRCData AS(
					Select distinct
					DB_NAME() As DBNAME,
					Convert(Varchar,UK.KMPONO) + ''/'' + Convert(Varchar,UK.KMPOSQ) + ''/'' + Convert(Varchar,UK.KMUGYR) + ''/'' + Convert(Varchar,UK.KMDANO) + ''/'' + CONVERT(VarChar,UK.KMCMSQ) AS [CLAIMREF],
					Convert(varchar,isnull(pocscd,'''')) as POCSCD,
					Convert(varchar,isnull(pomkrf,'''')) AS PMKRF,
					Convert(varchar,isnull(poplcd,'''')) AS POPLCD,
					Convert(varchar,isnull(poqdfg,'''')) AS POQDFG,
					Convert(varchar,isnull(pougty,'''')) AS POUGTY,
					Convert(varchar,isnull(pogucd,'''')) AS POGUCD,
					Convert(varchar,isnull(kmbhcd,'''')) AS KMBHCD,
					Convert(varchar,isnull(kmcccd,'''')) AS KMCCCD,
					Convert(varchar,isnull(kmdpdv,'''')) AS KMDPDV,
					Convert(varchar,isnull(kmevcd,'''')) AS KMEVCD,
					Convert(varchar,isnull(kmimcd,'''')) AS KMIMCD,
					Convert(varchar,isnull(kmiycd,'''')) AS KMIYCD,
					Convert(varchar,isnull(kmlocd,'''')) AS KMLOCD
					from UPPOREP UP Left join UKKMREP UK on UP.POPONO = UK.KMPONO AND UP.POPOSQ = KMPOSQ AND UP.POUGYR = UK.kmugyr AND UP.PODANO = UK.KMDANO)
			Select distinct
				C1.DBName,
				C1.POLICYREF,
				C1.CLAIMREF,
				C1.LossDescription,
				C1.LOSSCODE,
				C1.LOSSYEAR,
				C1.EventCode,
				C1.ClaimDescription,
				C1.StaticReserveReview,
				C1.EventCodeDescription,'+ @KeyString + ' AS ClaimKey,
				Round(CG1.OLR,2) as [OLR],
				CASE WHEN CG1.OLR <> 0 THEN ''OPEN'' ELSE ''CLOSED'' END AS [ClaimStatus]
				FROM CLAIMDATA C1
				LEFT JOIN COGDATA CG1 on C1.CLAIMREF = CG1.CLAIMREF
				LEFT JOIN CLAIMRCData CR on C1.CLAIMREF = CR.CLAIMREF
		UNION
				Select distinct
				C1.DBName,
				C1.POLICYREF,
				SUBSTRING(CG1.ClaimRef,1,Len(CG1.ClaimRef)-2) + ''/0'',
				''''					AS LossDescription,
				''''					AS LossCode,
				1912				AS LossYear,
				''''					AS EventCode,
				''''					AS ClaimDescription,
				''''					AS StaticReserveReview,
				''''					AS EventCodeDescription,'+ @KeyString + '	AS ClaimKey,
				0					AS OLR,
				''CLOSED''			AS CLAIMSTATUS
				From CLAIMDATA C1
				INNER JOIN COGDATA CG1 on C1.CLAIMREF = CG1.CLAIMREF
				LEFT JOIN CLAIMRCData CR on C1.CLAIMREF = CR.CLAIMREF
				Order by C1.POLICYREF'

			Select @SQL1

I always want to output @Keystring using a DFT but depending on the client the Keystring is set to a different group of columns and selects a different set of columns from the CLAIMRCData loop.

I tried inserting it as dynamic SQL as a variable but cannot get it to parse - does anyone know how to achieve this?

Here is the output from the Select @SQL1 which always returns the value I want and if i execute this and change the clientname it successfully returns the right claimkey each time - i.e. another client has 3 columns and these are successfully parsed - i just dont know how to get it into SSIS. Output as shown:

WITH CLAIMDATA AS(
				Select
				DB_NAME() AS DBName,
				Convert(Varchar,UK.KMPONO) + '/' + Convert(Varchar,UK.KMPOSQ) + '/' + Convert(Varchar,UK.KMUGYR) + '/' + Convert(Varchar,UK.KMDANO) AS [POLICYREF],
				Convert(Varchar,UK.KMPONO) + '/' + Convert(Varchar,UK.KMPOSQ) + '/' + Convert(Varchar,UK.KMUGYR) + '/' + Convert(Varchar,UK.KMDANO) + '/' + CONVERT(VarChar,UK.KMCMSQ) AS [CLAIMREF],
				left(19000000+KMLODT,4) as [LOSSYEAR],
				UK.KMLOCD AS [LOSSCODE],
				CASE WHEN KMLOCD = '' then COALESCE(UC.LOLODS,'') ELSE UC.LOLODS END AS LOSSDESCRIPTION,
				UK.KMEVCD AS [EVENTCODE],
				KMCMDS AS [CLAIMDESCRIPTION],
				CASE WHEN LEFT(KMCMDS,1) = '@' THEN 'Y' ELSE 'N' END AS [STATICRESERVEREVIEW],
				CASE WHEN UCE.EVEVDS IS NULL then COALESCE(UCE.EVEVDS,'') ELSE UCE.EVEVDS END AS [EVENTCODEDESCRIPTION]
				FROM UKKMREP UK
				LEFT JOIN UCLOREP UC ON UK.KMLOCD = UC.LOLOCD
				LEFT JOIN UCEVREP UCE ON UK.KMEVCD = UCE.EVEVCD),
	COGDATA AS(
				SELECT TOP 100 PERCENT
				CONVERT(Varchar,POLICY)+'/'+CONVERT(Varchar,CO.SEQ)+'/'+CONVERT(Varchar,CO.[YEAR])+'/'+CONVERT(Varchar,CO.[DEC])+'/'+CONVERT(Varchar,CO.CLAIM) AS [CLAIMREF],
				[Type],
				SUM(isnull(CO.KCR,0)+isnull(CO.ACR,0)+isnull(CO.[OCR],0)+isnull(CO.[EXP],0)+isnull(Co.[LOC],0)) AS OLR
				FROM COG626A CO
				Group by CONVERT(Varchar,POLICY)+'/'+CONVERT(Varchar,CO.SEQ)+'/'+CONVERT(Varchar,CO.[YEAR])+'/'+CONVERT(Varchar,CO.[DEC])+'/'+CONVERT(Varchar,CO.CLAIM), [Type]
				ORDER BY CLAIMREF

				),
	CLAIMRCData AS(
					Select distinct
					DB_NAME() As DBNAME,
					Convert(Varchar,UK.KMPONO) + '/' + Convert(Varchar,UK.KMPOSQ) + '/' + Convert(Varchar,UK.KMUGYR) + '/' + Convert(Varchar,UK.KMDANO) + '/' + CONVERT(VarChar,UK.KMCMSQ) AS [CLAIMREF],
					Convert(varchar,isnull(pocscd,'')) as POCSCD,
					Convert(varchar,isnull(pomkrf,'')) AS PMKRF,
					Convert(varchar,isnull(poplcd,'')) AS POPLCD,
					Convert(varchar,isnull(poqdfg,'')) AS POQDFG,
					Convert(varchar,isnull(pougty,'')) AS POUGTY,
					Convert(varchar,isnull(pogucd,'')) AS POGUCD,
					Convert(varchar,isnull(kmbhcd,'')) AS KMBHCD,
					Convert(varchar,isnull(kmcccd,'')) AS KMCCCD,
					Convert(varchar,isnull(kmdpdv,'')) AS KMDPDV,
					Convert(varchar,isnull(kmevcd,'')) AS KMEVCD,
					Convert(varchar,isnull(kmimcd,'')) AS KMIMCD,
					Convert(varchar,isnull(kmiycd,'')) AS KMIYCD,
					Convert(varchar,isnull(kmlocd,'')) AS KMLOCD
					from UPPOREP UP Left join UKKMREP UK on UP.POPONO = UK.KMPONO AND UP.POPOSQ = KMPOSQ AND UP.POUGYR = UK.kmugyr AND UP.PODANO = UK.KMDANO)
			Select distinct
				C1.DBName,
				C1.POLICYREF,
				C1.CLAIMREF,
				C1.LossDescription,
				C1.LOSSCODE,
				C1.LOSSYEAR,
				C1.EventCode,
				C1.ClaimDescription,
				C1.StaticReserveReview,
				C1.EventCodeDescription,pogucd+pougty AS ClaimKey,
				Round(CG1.OLR,2) as [OLR],
				CASE WHEN CG1.OLR <> 0 THEN 'OPEN' ELSE 'CLOSED' END AS [ClaimStatus]
				FROM CLAIMDATA C1
				LEFT JOIN COGDATA CG1 on C1.CLAIMREF = CG1.CLAIMREF
				LEFT JOIN CLAIMRCData CR on C1.CLAIMREF = CR.CLAIMREF
		UNION
				Select distinct
				C1.DBName,
				C1.POLICYREF,
				SUBSTRING(CG1.ClaimRef,1,Len(CG1.ClaimRef)-2) + '/0',
				''					AS LossDescription,
				''					AS LossCode,
				1912				AS LossYear,
				''					AS EventCode,
				''					AS ClaimDescription,
				''					AS StaticReserveReview,
				''					AS EventCodeDescription,pogucd+pougty	AS ClaimKey,
				0					AS OLR,
				'CLOSED'			AS CLAIMSTATUS
				From CLAIMDATA C1
				INNER JOIN COGDATA CG1 on C1.CLAIMREF = CG1.CLAIMREF
				LEFT JOIN CLAIMRCData CR on C1.CLAIMREF = CR.CLAIMREF
				Order by C1.POLICYREF

any help would be greatly appreciated - oh version is SQL 2014 SSIS

Thanks


James

Excel and Script Component

Hi All,

I have a requirement in which the task is to read data from .xls file and put it into a text file. The SSIS should read data from Excel cell A:4 to L:15 and also it should capture 1/16/2015 in a seperate column. The Month-Year value on the row is dynamic. Every month old month-year gets deleted and new month-year gets added to the excel sheet. For example one month from now, Feb-15 will be deleted and Jan-16 will be added to the end.

I tried this using SELECT * FROM [SHEET1$A4:L15], then i used unpivot transformtaion to get my data. But when i tried changing for example Mar-15 to March-15 it failed bcoz metada has changed. similarly suppose if i delete Feb-15 and add Jan-16 again my package failed. I think we  need to use script transformation to do this.  any idea how to do it using script.

I have written the below C # code but i am not getting any output:

Any help would be greatly appreciated.

I am using SSIS 2008R2

I have attached the input file(Excel Sheet) and also i have attached the expected output file(Text File).

Image may be NSFW.
Clik here to view.

Image may be NSFW.
Clik here to view.

using System;

using System.Data;

using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

using Microsoft.SqlServer.Dts.Runtime.Wrapper;

using SC_8f65b1fd232e416084be524f330491a4.csproj;

using System.Text;

using System.Data.OleDb;

using System.Windows.Forms;

[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]

publicclassScriptMain :UserComponent

{

   DataTable dt;

   conststring Delimeter =" ";

   int InventoryRow = 0;

   int ColumnOffset = 0;

   publicoverridevoid PreExecute()

   {

       base.PreExecute();

    }

   publicoverridevoid PostExecute()

   {

       base.PostExecute();

    }

   publicoverridevoid CreateNewOutputRows()

   {

       try

       {

           dt = LoadWorkbook(Variables.VarExcelFileName, "Sheet1");

           while (dt.Rows[InventoryRow][ColumnOffset].ToString().Trim() !="Grade")

           {

               InventoryRow++;

           }

           int ContractMonthRow = InventoryRow;

           int ContractMonthCol = 0;

           int BlankCount = 0;

           string Date;

                StringBuilder sb = newStringBuilder();

           Date = dt.Rows[1][5].ToString();

           MessageBox.Show(Date);        

           do

           {

               while (dt.Rows[InventoryRow][0].ToString().Trim() !="Cal Avg") 

               {

                   InventoryRow++;

                   if (dt.Rows[InventoryRow][ColumnOffset].ToString().Trim() =="Cal Avg")

                       break;

                  string LastMonthYear = (dt.Rows[ContractMonthRow][11].ToString());

                    while  ( dt.Rows[ContractMonthRow][ContractMonthCol].ToString() != LastMonthYear )

                   {

                       ContractMonthCol++;

                    

                       string SP = dt.Rows[InventoryRow][ContractMonthCol].ToString();

                       string MMYY = dt.Rows[ContractMonthRow][ContractMonthCol].ToString();

                       Output0Buffer.ContractMonth = SanitizeInput(MMYY);

                       Output0Buffer.Settleprice = SanitizeInput(SP);

                       Output0Buffer.publishxrefcode = dt.Rows[InventoryRow][0].ToString();

                   }

                    

                    string LastSP = dt.Rows[InventoryRow][ContractMonthCol].ToString();

                    string LastMMYY = dt.Rows[ContractMonthRow][ContractMonthCol].ToString();

                    Output0Buffer.ContractMonth = SanitizeInput(LastMMYY);

                    Output0Buffer.Settleprice = SanitizeInput(LastSP);

                    Output0Buffer.publishxrefcode = dt.Rows[InventoryRow][0].ToString();

               }

             

           }

                   }

       catch (Exception ex)

       {

           //throw ex;

       }

   }

   publicstaticDataTable LoadWorkbook(string FileName,string SheetName)

   {

   

       string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+ FileName +";Extended Properties=\"Excel 12.0;HDR=No;IMEX=1\"";

       

       OleDbConnection oledbConn = newOleDbConnection(connString);

       try

       {

         

           DataSet ds = newDataSet();

           oledbConn.Open();

           DataTable objSheetNames = oledbConn.GetSchema("Tables");

           OleDbCommand cmd;

           if (SheetName == null&& objSheetNames.Rows.Count > 0)

           {

               

               cmd = newOleDbCommand("SELECT * FROM ["+ objSheetNames.Rows[0][2].ToString() +"]", oledbConn);

           }

           else

           {

               cmd = newOleDbCommand("SELECT * FROM ["+ SheetName +"$]", oledbConn);

           }

           OleDbDataAdapter oleda =newOleDbDataAdapter();

           oleda.SelectCommand = cmd;

           oleda.Fill(ds, "LabOrder");

           return ds.Tables[0];

           

       }

       finally

       {

           oledbConn.Close();

       }

   }

   privatestaticstring[] _InvalidChars = { ",", "'", "\"" };

   publicstaticstring SanitizeInput(string value)

   {

       return SanitizeInput(value, _InvalidChars);

   }

   publicstaticstring SanitizeInput(string value,string[] InvalidChars)

   {

       value = value.Trim();

       foreach (string InvalidCharin InvalidChars)

       {

           value = value.Replace(InvalidChar, "");

       }

       return value;

       

   }

}

Running an SQL Server Agent Job to execute a package but the job FAILS on Connections

I have created a package which basically imports data from one database to another, The database where it collects the data from the job is failing on connecting reporting the following message:

Source: ****** Connection manager "Source - *****"     Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E4D.  An OLE DB record is available.  Source: "Microsoft OLE DB Provider for SQL Server"  Hresult: 0x80040E4D  Description: "Login failed for user '*ConnectionONE*'.".  End Error  Error: 2015-02-18 11:36:04.94     Code: 0xC020801C     Source: Data Flow Task Get Revenue Data [1]     Description: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "Source - *****" failed with error code 0xC0202009.

The package runs fine if executed within the package but fails from the SQL Agent Job.

NB * is to hide confidential data. *ConnectionONE* is the database which the package is attempting to get data from.

Completely puzzled on what to do as i have tried reading other forumns but they dont seem to be helping.

Any Help would be great thankyou!

Parameters for Ingesting wide fixed-length files?

I created an SSIS process to ingest fixed-length text files into this table.

CREATE TABLE [dbo].[Temp_Source_Fixed](
 [Column 0] [text] NULL,
 [ID] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [Temp_Source_Fixed_ID] PRIMARY KEY CLUSTERED
(
 [ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

It works fine with most of the files, but one file has almost 26000 characters per row and the process halts with a truncation error.
I suspect that if I change a parameter on the connection manager it will work, since I can manually use
the SSMS wizard to import manually if I specify Text Stream (DT_Text) for the data type of Column 0 versus String (DT_STR).

For the connection manager I have
    In the connection string I have Provider=SQLNCLI10.1 and Auto Translate=False.
    In Misc parameters, DelayValidation=False.

For the Data Flow Task I have
 DefaultBufferSize is 10485760

Any ideas on what I need to change?

Thanks,
Jnana


Jnana Sivananda

SSIS package with OData connection - can't connect

I need to read some data from a SP list. I have the OData connection manager setup. When I test the connection to my sharepoint site, it says it's successful. I added in a data flow task and then an OData Source. In the OData Source editor, I select the Odata connection manager. I want to use a collection. However, it says "Unable to load collection for the connection Odata Source, reason: Cannot open this connection"


Anybody know how to resolve this?


DTS packages

I have migrated the DTS packages (which was running in SQL 2000 Server) to SSIS Packages (2008) (through
Migrate 2000 DTS Package option in Visual Studio).
The below is error I am getting when we execute the SSIS package in SQL Server 2008 R2 Server.
Environment : SQL Server
2008 R2
Version : 64 bit
Version
Date  2/18/2015 5:10:15 PM
Log  Job History (Oracle to Access - PROD)
Step ID  1
Server  CSVP000A1037\WWSHRD02
Job Name  <TestJob>
Step Name  Test Oracle to Access
Duration  00:00:01
Sql Severity  0
Sql Message ID  0
Operator Emailed 
Operator Net sent 
Operator Paged 
Retries Attempted  0
Message
Microsoft (R) SQL Server Execute Package Utility
Version 10.50.6000.34 for 64-bit
Copyright (C) Microsoft Corporation 2010. All rights reserved.
Started:  5:10:15 PM
Error: 2015-02-18 17:10:16.42
   Code: 0x00000000
   Source: TEST_TABLE
   Description: This task does not support native Win64 environment. Please run the package in 32-bit WOW environment instead.
End Error
Error: 2015-02-18 17:10:16.42
   Code: 0xC0024107
   Source: TEST_TABLE
   Description: There were errors during task validation.
End Error
DTExec: The package execution returned DTSER_FAILURE (1).
Started:  5:10:15 PM
Finished: 5:10:16 PM
Elapsed:  0.546 seconds
 
The below one is the SQL script command which we have used in 2008 Server we are trying to execute through SQL Job scripts.
 
@command = N'dtexec /ser servername\instancename /sq Oracle2Access_PROD', @database_name = N'', @server = N'', @database_user_name = N'', @subsystem = N'CmdExec', @cmdexec_success_code = 0, @flags = 0, @retry_attempts = 0, @retry_interval = 0, @output_file_name = N'', @on_success_step_id = 0, @on_success_action = 3, @on_fail_step_id = 0, @on_fail_action = 2

 

I have set this package property Run64BitRunTime = False

 Please help me how to resolve the issue.

Thanks,

Vijay

SFTP and CozyRoc

I need to create an SSIS package that handles dealing with SFTP and could use some insight/help. Here's the scenario in a nutshell:

We are connecting to one of our vendors FTP servers via SFTP. Once on the server, we need to retrieve a file with a format of let's say I_NEED_THIS_FILE_CCCCMMDD, where CCCCMMDDHHMMSS is the date of the file with the time.

What I need to do is find any files with that format, but I'm only interested in the most recent one. If the process finds more than one file matching that format, it needs to move the other files to a specified folder and only retrieve the most recent one.

I have downloaded CozyRoc in order to use their SFTP SSIS component. It has a task for both retrieving files on an FTP server as well as renaming files.

My question is has anyone done something similar to what my needs are utilizing the CozyRoc component, and if so, how did you address the issue of looking for a certain file name with a certain date range (file date)?

Any help would be greatly appreciated!

And I'm sure this can all be accomplished utilizing custom scripts, but unfortunately, I'm not the strongest of script writers...so the easier the better...


A. M. Robinson


For Each Loop container help

I have a package that inserts data from multiple flat files and it also captures the file name from the path. I have qualified in the enumerator to pick only files with *.BID extension from the source folder, However What I want is if there`s a file with lets say .txt extension after the package is run it should move the incorrect files into another folder and send out an alert email to the team.

How can i capture this kind of functionality


FM

Non existent table still in sys.objects, how to fix that?

I have moved a table from one table schema to another one (dbo.MY_TABLE to RAW.MY_TABLE), using ALTER SCHEMA..., the problem is when our ETL is trying to remove all the constraints it finds 2 records (dbo.MY_TABLE), one for the user table and the other the PK of that table. The problem is that the sys.objects points to dbo.MY_TABLE which now doesn't exist anymore. How could I update the sys.objects table to correctly reflect that the table has moved table schema?

SSIS Import Failure from CSV into View with UDF

I cannot seem to import (using SSIS) into a View with a function on it. Take this simple table and view:

create table test_table (COL1 varchar(32), COL2 NVARCHAR(32));
create view test_view as select COL1, COL2 from test_table;

Then create a simple two column CSV for import. E.g., abc,def.

Finally create an SSIS import package to import the CSV into test_view (not test_table).  Everything works fine. After executing the package, COL1 contains "abc" and COL2 contains "def";

Now modify test_view to contain a function, e.g.,

alter view test_view as select COL1, upper(COL2) as [COL2] from test_table;

Now run the SSIS package again.

Now COL1 contains "abc", but COL2 is NULL!  Yet, a simple Insert command works as expected, e.g.,

insert into test_view (COL1, COL2) values ("abc", "def");
select COL1, COL2 from test_view;

After the insert the result set is "abc", "DEF" as expected.

Is this a limitation on SSIS that it cannot import into a column with a function on it? Is there any way around this?

Thanks.





SSIS - Loop through files from a file path based on the value in the variable

Experts,

I have a requirement where I'll be loading multiple files in to a SQL server table and archive the files when loaded. However, the challenge is , the file path should be dynamic based on the value of a variable (say, @ProductName).

For example: If I am running the package for variable @ProductName="Product", the file path would be "\\....\Src\Product", in that case the ForEachLoop will loop through all the files in that folder, load them to the table and Archive the files to the "\\....\Src\Product\Archive" folder.

Similarly, if the @ProductName="Product_NCP", the foreachloop container should loop through files in the "\\....\Src\Product_NCP" folder, load them to the table and archive them to the ""\\....\Src\Product_NCP\Archive" folder.

Any suggestions? I should be able to run the package manually just by passing the "@Product" value, create Archive folder if it doesn't exist, load the data and archive the files.

SQL SERVER AGENT JOB ERROR - SSIS PACKAGE

Hi , 

I have a SQL server agent job which runs SSIS package as the daily job. The SSIS package contains multiple child package. Its a master package which calls other SSIS package. The master package calls 23 SSIS packages, few of the packages runs in parallel. I am getting the below 2 different errors more frequently. It fails only in the production server, I scheduled the job in UAT server, it did not fail. Also when we run the master package with out sql agent job, it did not fail. 

Error 1 :

R6025  - pure virtual function call.  The return value was unknown.  The process exit code was 255.  The step failed.

Error 2 : The step did not generate any output.  The return value was unknown.  The process exit code was -1073741819.  The step failed.

We tried browsing for the answers ,no luck. It failing in live , so we need to run the package manually in live server every time. 

Please help me to resolve this issue. Thanks in advance.

Regards, 

Dhivya Sivakumar

Viewing all 24688 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>