Quantcast
Channel: SQL Server Integration Services forum
Viewing all 24688 articles
Browse latest View live

Deleting and Inserting set of records based on Date Field

$
0
0

Hi Experts,

I am trying to update a table with last two weeks data on daily basis.

I first delete the last two weeks data based on a Date Field in the Table. For this I get the system datetime and do something like: 

Where Clause - > DateField = Getdate()-11 days.

While inserting, I do the same. However, the time lapse in the system date between the delete and insert is causing the data to lose.

I am quite new to these tasks. I appreciate if anyone could help me a step by step approach on how to do achieve my requirement.

Or any links to guide me will help.

Thanks heaps in advance.


Unable to publish SSIS project to SSIS catalog

$
0
0

I have created a new Integration Catalog on one of our SQL Servers (SQL 2014)

and I have a project that I want to deploy to it, but when I try and connect to the folder browser I get the following message

"the server principal "SQLdomain\username" is not able to access the database "SSISDB" under the current security context. (Microsoft SQL Server, Error : 916)"

The SQL server is on a different domain to the main office domain and I connect via SQL user account.

How do I get the project to deploy under my SQL user rather than a domain account?

Thanks

Failed to deploy the project. Try again later. (Microsoft SQL Server, Error: 27118)

$
0
0

Hi Experts,

Anybody know this error message? Do you know its root cause? And how to resolve it? I encountered this when I was deploying a SSIS project to Integration Services Catalogs. My Visual Studio is 2010, SQL Server Data Tools. And the data engine on the server side is SQL Server 2012, Enterprise edition, version 11.1.3128.0.

Detailed Error Message:

Failed to deploy the project. Try again later. (.Net SqlClient Data Provider)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=11.00.3128&EvtSrc=MSSQLServer&EvtID=27118&LinkId=20476

------------------------------
Server Name: MSSCIAIDB01
Error Number: 27118
Severity: 16
State: 1
Procedure: prepare_deploy
Line Number: 221


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

   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.SqlServer.IntegrationServices.Common.ObjectModel.SqlHelper.ExecuteSQLCommand(SqlStoreConnection storeConnection, CommandType cmdType, String cmdText, SqlParameter[] parameters, ExecuteType execType, Int32 commandTimeout)
   at Microsoft.SqlServer.Management.IntegrationServices.CatalogFolder.DeployProject(String projectName, Byte[] projectStream)
   at Microsoft.SqlServer.IntegrationServices.Wizard.Common.Model.DeployExportProjectHelper.DeployProject(CatalogFolder folder, Project project)
   at Microsoft.SqlServer.IntegrationServices.Wizard.Common.Model.DeploymentModel.Deploy(CatalogFolder folder, Project project)
   at Microsoft.SqlServer.IntegrationServices.Wizard.Common.Model.DeploymentModel.DeployProject()
   at Microsoft.SqlServer.IntegrationServices.Deployment.DeployProjectPage.DoWork(Object sender, DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

Derived column in SSIS?

$
0
0

Hi there,

In my source (SQL table) have got this column:

FORECAST_QTY numeric no 17 32    16    no (n/a) (n/a) NULL

When I generate a flat file I get this value:  .0000000000000000 instead of 0.0000000000000000

How can i tell to SSIS that writes the last value with 0 in first place?

Importing excel, modifying it, exporting the same excel.

$
0
0

Hi experts, I need to automate this:

 

-import excel file. 6 columns.

-in sql, do a join using the Id of the previous excel and populated a 7<sup>th</sup> column.

-Export the 7 columns to an excel.

 

My question is: should I create a table to hold this? or let SSIS import it to a temp table and work there?

Restore all databases in SSIS package.

$
0
0
I need help from someone to create a package which restores multiple db's from remote .bak files to local instance. This later need to be scheduled via SQL agent by passing the parameters.  I have made via t sql but dont know to loop multiple db's with script in ssis. 

SANTHOSH KUMAR


Launching SSIS Report

$
0
0
Is there a way to launch the built in reports via code? I want to have it displayed after the package completes whether it succeeds or fails instead of manually right clicking in sql server management studio and going to all reports to see the status. Thanks

Assigning a value to output variable in SSIS Script Component...

$
0
0

Hi all,

I am having an issue with writing an value to a variable inside ssis script component.

trying to convert a file from ansi  to utf-8.Here are the steps i followed:

  • Created a variable Readonly with string and passed the file as value.
  • Created a variable readwrite with string.

This is the code inside the script component:

      string text = File.ReadAllText(filename, Encoding.Default);         

            // write as UTF-8
            File.WriteAllText(path2, text, Encoding.UTF8);

I need to get the value of the variable and assign to filename and get the converted file and assign to the variablePath2.


Removing parameterize connections from ssis package

$
0
0

Hi,

I have parameterrize some of the connection strings in ssis package but after that i have removed these parameters from the parametes tab but when i deploy the ssis package to sql server 2012 and check the configurations of the package there i can see the pld removed parameters how to remove these parameterize connection.

i am using visualstudio 2010 and sql server 2012.

please let me know if you have any questions.

Thanks



Redirect rows on error and fail component to recapture error description

$
0
0

Hi,

Requirement : I have a simple package which load flat file to SQL table. In case an error encountered while inserting or updating record to destination table

1) Error row needs to be redirected to error table. (Every destination table has an error table whose structure is similar to destination except data type of columns, In case of error table all columns will be varchar)

2) And at the same time I want to fail component so that i want to capture error detail from variable "System::ErrorDescription" (because i have an audit table which contains information like Package name, start time, End time, Status (In progress, Success and fail) and Error description

for Oledb destination component i have made the following changes as can be notice in the below image

1) I have set "On Error" property to "Redirect row"

2) I have set "Set this value to selected cell" property as fail component.

Issue: When i run the package "on Error" rows are redirecting to error table but data flow task is running successfully and hence i am not able to capture error description.

Any help is appreciated.




SSIS and use of RaiseError in Execute Sql Task

$
0
0

I have a Error variable in a package that creates a string Error Message. Then in an execute sql task I have added the Error variable

The syntax for the execute sql task is as follows:

 raiserror( ?,16,1)

This does fail the package when it hits this task but gives me the below error and does not put my manually created error in the log file.

Error: 0xC002F210 at xx Package failed due to Erorr - Investigate, Execute SQL Task: Executing the query "    raiserror( ?,16,1)

" 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.
Task failed: 

Any ideas how to resolve this ?

New - Forum Ninjas Blog!

$
0
0

Forum Ninjas blog was launched!

The Forum Ninjas blog is the official blog of the MSDN and TechNet Forum members, which means you, if you read this message.

In the "Hello world!" blog post, you can read more about: Who are we, and what this blog is about, Calling more bloggers, What’s next, and The people behind the scene. You'll also see our first interview blog post!

Visit at the Forum Ninjas blog at https://blogs.msdn.microsoft.com/forumninjas/

Have fun, and feel free to send us feedback!


Ed Price, Azure Development Customer Program Manager (Blog,Small Basic, Wiki Ninjas, Wiki)

Answer an interesting question? Create a wiki article about it!

Maintenance Plans failing with error " Failed to acquire connection "Local server connection".

$
0
0
We've recently migrated our database instance to a new server. Post migration, our maintenance plans are failing with the below error:-

Description: Failed to acquire connection "Local server connection". Connection may not be configured correctly or you may not have the right permissions on this connection.

We've already changed MsDtsSrvr.ini.xml file to have full instance name as the server is clustered after which we are able to connect to SSIS and jobs that run other packages are running fine. But maintenance plans are still failing. 

The SQL Server Agent and the database engine are running with the same service account as the Integration Service. The service account has sysadmin access to the server. 

We've also checked the data source in our maintenance plans and the local server connection which are pointing to the correct instance. We've also tried creating new maintenance plans but they are still failing with the same error. The SQL Server version is 2012 SP2 and windows version is 2012 R2.

This is stalling our maintenance activities on our prod servers. Can someone please help out with this?

Saurabh Vaish

Need to load the Successful run messages of all steps in SSIS package to a text file.

$
0
0

Hi,

I am working on a SSIS package which has different data flow tasks. Upon package success or failure, I want to notify that in a text file, which gives the message of success or failure of data flow tasks which I have in the package.

For example,

I have 3 data flow tasks, now after completion of my package. I want to send the message to a text file in my local path which says

Data flow task 1 status : Success

Data flow task 2 status : Success

Data flow task 3 status : Success.

In this way, I want to show in the text file. Can anyone help me in this?

We are not using Send mail task for this purpose, we need to send the message to the text file for each and every step of the package...


Rahul


JSON Webservices Fetch to SQL Table

$
0
0

Hi all,

I'm trying to fetch data from restAPI in a JSON format. I want to load the data by script component.

Can someone please provide me the script that connect to the web-service in a way that i send the API key in the header?  

The problem is not fetch the data, but to connect the script component to the web-service.

And how can i send a query to the api that limit the data that i fetch by date?

Thanks a lot!

Avi



Deploying SSIS pacakge with Oracle Attunity connection

$
0
0

We have developed several packages with Oracle Attunity connection (Project level connection). While we deploy this package using SQL server agent the job when runs it fails. This is due to the password is NULL for oracle connection. Our package protection level property is SaveSensitiveDataWithUserKey.

So at this moment what is the correct method to deploy the packages to make it run via SQL server agent.


Sarvan

Microsoft connector V3

$
0
0

Hi,

We are using Microsoft connector V3 on server but I am getting error as Oracle registry cannot be opened.

Server details:

Windows 12

64 bit machine

SSIS installed

Following are the questions:-

1 .Why the error is generated as oracle registry cannot be opened.

2. If suppose multiple oracle home is installed on server then which oracle home should be set as environment variable.

3.Is some licence required for using Microsoft connector V3 for oracle.

Please reply ASAP .

Regards

Ritika

ScriptComponent ThreadPool: randomly exits Main method.

$
0
0

Hi all,

Short intro on what I try to do and how I have built it: I need to read a SharePoint list with +6000 listitems and I need to get the versionhistory of each item, which actually means requesting versioning-data for each field of each listitem. Long story short: this results in about 620000 requests that have to be made to the SharePoint Webservices. Doing this in a single-threaded setup would take forever to load, so multi-threading is the way to go. Also, this is still on on Sql 2008 R2, which means .NET 2.0, which means that I can't use the new parallel processing stuff they've added to .NET 4.0, so I figured using the ThreadPool was my easiest way forward.

So, in my main method, I enumerate over all the fields of the listitems, and I made a method (which I'll queue as workitems to the threadpool) that takes the listID, listItemID and fieldname as parameters and that gets the versionhistory of that field. After it has read the versionhistory, it adds this data in OutputBuffer of the ScriptComponent. 

I also created a TaskInfo Class which holds the data object that pass to my ProcessListItemField method when I queue it for the ThreadPool.

So, first, in my main method:

foreach (XmlNode ListItem in results.SelectNodes("descendant::z:row", NamespacesMgr))
        {
            ProcessListItem(ListItem, ListUID);
        }


Which executes this method:

private void ProcessListItem(XmlNode listItem, String ListUID) { String ListItemID = listItem.Attributes.GetNamedItem("ows_ID").Value.ToString(); String ListItemCreatedDateTime = listItem.Attributes.GetNamedItem("ows_Created").Value.ToString(); foreach (XmlAttribute ListItemField in listItem.Attributes) {

//This is where I add the task to get and process the listitems versionhistory to the ThreadPool ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessListItemField), new TaskInfo(Int32.Parse(ListItemID), ListItemField.Name, ListUID, DateTime.Parse(ListItemCreatedDateTime))); workitems = workitems + 1; } }

As you can see in the above snippet, I keep a count of the number of workitems I queue in the integer 'workitems'. This integer is decreased with 1 at the end of each ProcessListItemField that I added to queue.

So, this adds the following method as a task to queue to be executed by one of the available threads in the ThreadPool:

public void ProcessListItemField(Object taskinfo)
    {
        IDTSComponentMetaData100 myMetadata = ComponentMetaData;
        bool fireagain = false;
        try
        {
            TaskInfo taskInfo = (TaskInfo)taskinfo;
            XmlNode ListItemFieldVersionCollection = ListsService.GetVersionCollection(taskInfo.ListUID, taskInfo.ListItemID.ToString(), taskInfo.ListItemField);
            foreach (XmlNode ListItemFieldVersion in ListItemFieldVersionCollection.ChildNodes)
            {
                Output0Buffer.AddRow();
                Output0Buffer.ListItemID = Int32.Parse(taskInfo.ListItemID.ToString());
                Output0Buffer.FieldName = taskInfo.ListItemField; //varchar(500)
                Output0Buffer.Modified = DateTime.Parse(ListItemFieldVersion.Attributes.GetNamedItem("Modified").Value.ToString()); //varchar(50)
                Output0Buffer.Editor = ListItemFieldVersion.Attributes.GetNamedItem("Editor").Value.ToString(); //varchar(1000)
                Output0Buffer.Value = (taskInfo.ListItemField == "ows_Created" ? taskInfo.ListItemCreatedDateTime.ToString() : ListItemFieldVersion.Attributes.GetNamedItem(taskInfo.ListItemField).Value.ToString()); //varchar(Max)
            }
            workitems = workitems - 1;
        }
        catch(Exception ex)
        {
            myMetadata.FireWarning(0, "ScriptComponent", "Error while processing ListItemID " + ((TaskInfo)taskinfo).ListItemID.ToString() + " - " + ex.Message, String.Empty, 0);
        }
    }

Finally, in my main method I do the following to make sure that the main method does not finish before all workitems have been processed by the background threads:

while (workitems > 0)
        {

                int avWorkerThreads;
                int avCompletionPortThreads;
                ThreadPool.GetAvailableThreads(out avWorkerThreads, out avCompletionPortThreads);
                myMetadata.FireInformation(0, "ScriptComponent", " [" + DateTime.Now.ToString("G") + "] - There are currently " + avWorkerThreads.ToString() + " WorkerThreads available.", String.Empty, 0, ref fireagain);
                myMetadata.FireInformation(0, "ScriptComponent", " [" + DateTime.Now.ToString("G") + "] - There are currently " + avCompletionPortThreads.ToString() + " CompletionPortThreads available.", String.Empty, 0, ref fireagain);
                myMetadata.FireInformation(0, "ScriptComponent", " [" + DateTime.Now.ToString("G") + "] - There are currently " + workitems.ToString() + " workitems in the Threadpool.", String.Empty, 0, ref fireagain);


            Thread.Sleep(10000);
        }

This results in a log that looks like this when I'm debugging:



This now all works fine except two issues I'm facing:

  • As you can see, while I have more than enough work in the queue and still +1700 threads available, performance is still pretty bad, about 60-70 requests per 10sec, is there any way to boost this?
  • The script randomly exits: no error, no warning, no exception or whatever, it just exits and says the package is ready. It seems it entirely ignores the while-loop that I inserted in the main method to wait for all the workitems to finish. The screenshot above shows this: no error or finish message at the end of the scriptcomponent-logging while VS shows the message that the job is done. Any ideas on what might be the issue here?

Thanks!

C

Strange behaviour when producing a lot of log-events

$
0
0

Hi,

I've made a script for a script-component in a data flow. For debugging purposes I've used FireInformation a few times to give me some feedback on what the script is doing. But since the script takes a long time, and a lot of Information Events occur, the log get's really long. Now, I noticed that my job just stops after a while, not completing at all, no errors in the log. So I figured, maybe I'm just logging to much, so reduced the number of FireInformation lines by introducing a 'debuglevel' variable with which I can adjust the amount of debugging information flowing to the log. And sure enough, now the job runs smoothly.

So, my question: is there a limit of the amount of lines the log can carry when executed manually from visual studio?
FYI: this is SQL 2008 R2, pretty old, running on 64bit Win7 laptop with 16Gb RAM.

Kind regards,

Cedric

config file to store connection string or variable?

$
0
0
What would be best practice where to store a connection string. In a config file or a pkg variable? Or any other place?  Thanks for suggestions.

LISA86

Viewing all 24688 articles
Browse latest View live


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