How To Add Reference To SSIS Script Task

Sep 4, 2006

Hi ALL

I cannot add the reference to the following:
"Imports Microsoft.AnalysisServices.AdomdClient"
in SSIS script task. All the objects that i declared become underlined because there is no reference to the above library.
When i go in SSIS script task and open the code to add the reference it does not the list the above library.
I am able to add reference in Visualstudio but not in SSIS.

Please adivse, it is very critical and urgent for my task

Thanks.

View 5 Replies


ADVERTISEMENT

How Do You Get A Reference To The Task Host In An SSIS Task

Feb 26, 2008

I've created my own posting for this. The original post was here, I apologize: http://forums.microsoft.com/forums/ShowPost.aspx?PostID=2906512&SiteID=1

According to the poster it's not possible. But there has to be some way to do it? Reflection (don't know how)?


I need to get a reference to the task host in an SSIS Task component.

Basically the scenario is this:

I have a custom task I have created. However I would like to validate that the ExecValueVariable is infact a string variable during the validate event of the task. I know how to verify its a string variable. But I can't figure out how to read what the user selected (such as User::Myvariable). The only way I've been able to figure out how to do it, but it only works if you open my custom task UI.

What I did is this:

I've implemented IDtsTaskUI and during the initialize section I wrote:

Sub Initialize(ByVal taskHost As TaskHost, ByVal serviceProvider As IServiceProvider) Implements IDtsTaskUI.Initialize
' Store the TaskHost of the task.
Me.taskHostValue = taskHost
Dim myTask As CustomTask= CType(taskHost.InnerObject, CustomTask)
myTask.myTaskHost = taskHost
End Sub

My Task is named: CustomTask. I have a public variable in my task as follows:

Public NotInheritable Class CustomTask
Inherits Task
Implements IDTSComponentPersist
Public myTaskHost As TaskHost = Nothing

Therefore I pass back the taskhost value to the CustomTask class, and voila I have it.

Problem is, this only works if the custom task calls the initialize method, and this only happens when you open the custom editor.

I then do the validation in my CustomTask class and it works fine, but myTaskHost is null/nothing until you actually open the custom task UI

How do I solve this?



View 10 Replies View Related

Adding A Web Reference (web Service) To An SSIS Script Task?

Apr 5, 2007

Is it possible to do this under SSIS 2005? How? I see I can add a reference to system.web.services.dll.. but then what?



The web service was developed in vb.net/vs.net 2005 and I have no problem adding and consuming it from a web page developed using vs.net 2005 - asp.net/vb.net.



Thanks for any help or information.







View 3 Replies View Related

Script Task DLL Reference W/o Being In GAC

Oct 25, 2006

I need to add a reference to a DLL from a script task. But I do not have the ability to put the DLL in the GAC. The DLL is a 3rd party DLL and they do not want to strong name it because that creates a chain effect having to strong name all DLL's that are used in their projects that share the DLL I need to refernce.

Ok my question is.. Can i reference that DLL somehow in the script task by manually adding the reference at runtime? I found this next snippet of code on the internet, i cant get it to work though.

Public Overridable Function CreateReferenceItem(ByVal itemName As String, ByVal assemblyName As String) As IVsaReferenceItem
Debug.Assert(Not (itemName Is Nothing) AndAlso Not (itemName = String.Empty))
Me.AssertEngineItemUnique(itemName)
Dim item As IVsaReferenceItem = CType(_engine.Items.CreateItem(itemName, VsaItemType.Reference, VsaItemFlag.None), IVsaReferenceItem)
item.AssemblyName = assemblyName
Return item
End Function



View 6 Replies View Related

Getting A Reference To A Script Task In VB.net

Oct 6, 2006

I am trying to get a reference to a script task so I can manipulate it's properties. However I can't seem to figure it out? I have a reference to Microsoft.SqlServer.ManagedDTS and Microsoft.SqlServer.Dts.Design and based on BOL they show

Imports System

Imports System.Collections.Generic

Imports System.Text

Imports Microsoft.SqlServer.Dts.Runtime

Imports Microsoft.SqlServer.Dts.Tasks.BulkInsertTask

Imports Microsoft.SqlServer.Dts.Tasks.FileSystemTask

Imports Microsoft.SqlServer.Dts.Runtime

But I get errors saying

Imports Microsoft.SqlServer.Dts.Tasks.BulkInsertTask

Imports Microsoft.SqlServer.Dts.Tasks.FileSystemTask

can't be found? What do I need to reference or Import to be able to see the Tasks and/or Task types so I can convet InnerObject to a ScriptTask type and manipulate?

What am doing wrong?????

Dim pkgPath As String = "C:Program Files\ETLODSPolicy"Dim pkgName As String = "LoadOdsCountryCodes"

Dim pkg1 As String = pkgPath + pkgName + ".dtsx"

Dim pkg2 As String = pkgPath + pkgName + "2.dtsx"

Dim app As Application = New Application()

Dim pkg As Package = app.LoadPackage(pkg1, Nothing)

Dim x As Executable

For Each x In pkg.Executables

Dim t As TaskHost = CType(x, TaskHost)

If t.Name = "SCT Set Global Variables" Then

Dim sct As ???? = ctype(t.InnerObject,????)

End If

Next

View 4 Replies View Related

Can You Reference A Package Using ActiveX Script Task?

Aug 23, 2007



Using ActiveX Script Task it is possible create office automation objects such as Word and Excel typically using the CreateObject() Syntax. Can you use this syntax to create a Package object using CreateObject("DTS.Package")? If not Why not? I am not sure whether it was possible in DTS.

I am aware of the fact that ActuveX Script Task is included in this Version of SSIS and will be deprecated.

View 2 Replies View Related

Change Self Reference Values In A Data Flow Task

May 9, 2006

Hi,

We migrate data from a legacy system to new system using SSIS. The primary key of legacy system is a user-defined sql server which holds alpha-numeric values. The primary key of new system is a big int(sequential numbers).

When we migrate data, we generate a sequential number for each legacy key(the primary key of legacy data) and insert data in to new system tables. The newly generated sequential numbers and the legacy keys are persisted in an intermidiate table for look up operations of child tables.

We are facing problem when we try to migrate tables which has self referring coulumns. For example a table called Employee has a column ManagerKey which refers to Key column of Employee table. We are struck up in defining data flow tasks to replace legacy ManagerKey column values with the new values(sequential values) generated during the migration process.

Please help me to solve this problem.

Regards,

Gopi









View 3 Replies View Related

Unable To Reference Dts.Runtime.Wrapper From Script Task

May 11, 2007

Hi,



I am currently trying to create a Script Task which reads in a file containing meta-data which then dynamically creates a Flat File Connection Manager and configures it using this meta data. After perusing various newsgroups and articles, it seems that I need to be able to reference the Dts.Runtime.Wrapper to do this. I have tried using the Add Reference dialog, but it does not contain a reference to this namespace. I can reference this namespace from a "Script Component" but I am unable to reference it from a "Script Task". Is this a known issue or am I just not doing something correctly? If anyone could give me any pointers it would be greatly appreciated. Thanks!



Michael

View 7 Replies View Related

Is There Away To Reference Global Variables In A Lookup Transformation That Are Set Outside A Data Task Flow?

Mar 31, 2008



The logic I am trying to recreate via SSIS is the following SQL statement:

insert into db3.dbo.targettable1 -- Target database table
(SiteC,
Objecte,
Attrib1)

select distinct ?,
?,
from ? -- Source database table
join dbo.targettable2 c1 -- Target database table
on c1.Alias = ? and
c1.CSetID = ? and
c1.FacID = (select f.PFacID
from dbo.Fac f
where f.FacID = ?)
where not exists (select * from dbo.targettable2 c -- Target database table
where c.Alias = ? and
c.FacID = ? and
c.CSetID = ?)


I have an OLE DB Source that consists of an expression to approximate the following portion of the Above Select statement:

Select ?,
from ? -- Source database table and

The package has 2 global variables User:CSetID and User::FacID whose scope is global to the package and whose values are set within a Foreach Loop Container outside of the Data Flow Task

I was trying to reference the 2 global variables within the Looup Transformation to recreate the following portion of the SQL statement.but encounter errors:



join dbo.targettable2 c1 -- Target database table
on c1.Alias = ? and
c1.CSetID = ? and
c1.FacID = (select f.PFacID
from dbo.Fac f
where f.FacID = ?)


In the Advanced Editor window of Lookup Transaction

select * from
(select * from [dbo].[targettable2 ]) as refTable
where [refTable].[Alias] = ? and [refTable].[FacID] = ? and
[refTable].[CSetID] = ?



Is there away to reference global variables in a Lookup Transformation that are set outside a Data Task Flow?

View 3 Replies View Related

SSIS - Need To Reference .NET Assembly Without GAC

Jan 25, 2007

I have a .NET assembly that I need to reference and use within my SSIS script task.
The only way I can acheive this is to strongly name my assembly and put it in the GAC.
This is not possible as my assembly is already in production and uses other 3rd party assemblies that would also need to be registered in the GAC.
As a workaround, I have created a .Net console application that references my assembly, that call from a SSIS Process Task.
Does anyone know of another way I could use my .NET assembly within my SSIS package?
Any help appreciated.
 Regards,
Paul.

View 3 Replies View Related

SSIS Reference Manual

Sep 14, 2006

I never had to use DTS in MSSQL 2000 but I'm finding a need to use SSIS quite a bit in a new position. I know this is subjective, but I looking for suggestions for a reference book with good examples and tutorials.

TIA

View 3 Replies View Related

SSIS Task Transfer SQL Server Objects Task And Default Constraints On Tables

Feb 21, 2008



I am using the "Transfer SQL Server Objects Task" to copy some tables from database A to database B including data.

The tables, primary key constraints, Foreign key, data and all transfers nicely except for "DEFAULT CONSTRAINTS" on the tables.

I have failed to find any option in the "Transfer SQL Server Objects Task" task to explicitly say "copy default constraints". So I guess logically it should happen automatically but it doesn't. I hope it is not a bug :-)

Any option anyone knows will help.

Thanks.

View 17 Replies View Related

SSIS (Integration Services) Transfer SQL Server Objects Task: This Task Can Not Participate In A Transaction

Feb 1, 2007

In short, does the €œTransfer SQL Server Objects Task€? support distributed transactions?

In trying to use a €œTransfer SQL Server Objects Task€? in a container using a transaction on the container. The task is set to support the transaction. It is setup to copy table data from several tables from a non-domain server (sql server 2000) to a domain-based server (sql server 2005). I get an error stating, €œThis task can not participate in a transaction€?.

I am wondering if it means exactly what it says €“ this task in SSIS can€™t participate at all. Or does it mean that it won€™t in this scenario for some reason. I attempted a simple copy of data from mssql 2005 to mssql 2005 (same server) and the task still failed). MSDTC appears to be running properly on my machine and such (I can do a simple distributed transaction across linked server to the 2000 server in Query Analyzer (QA)). Also, MSDTC appears to be working on both servers with distributed transaction query tests in QA.

Here€™s the error info€¦

SSIS package "Development BusinessContacts and Products Migration.dtsx" starting.
Information: 0x4001100A at Copy BusinessContacts Data: Starting distributed transaction for this container.
Error: 0xC002F319 at Copy BusinessContacts database table data 1, Transfer SQL Server Objects Task: This task can not participate in a transaction.
Task failed: Copy BusinessContacts database table data 1
Information: 0x4001100C at Copy BusinessContacts database table data 1: Aborting the current distributed transaction.
Information: 0x4001100C at Copy BusinessContacts Data: Aborting the current distributed transaction.
SSIS package "Development BusinessContacts and Products Migration.dtsx" finished: Failure.
The program '[4700] Development BusinessContacts and Products Migration.dtsx: DTS' has exited with code 0 (0x0).

View 9 Replies View Related

Reference Documentation On VBA In Relation To SSIS

Feb 21, 2006

Hi, I have heard alot of people talk about using C# for scripting withing SSIS and the answer to that question is no apparently. You can only use VBA but there is no extensive or in my respect any documentation as reference for using VBA in SSIS. I am new to VBA because i used to use jscipt and vbscript in early version of sql server. But in order to learn using VBA, I need to learn it in which there seems to be no reference in relation to SSIS. All the VBA references you find are in relation to MS Office. Is there anything i am missing or can someone show me where to go as my reference for VBA in SSIS. Its bad enough to change the scripting language but worse not to provide any reference materials for uses to get up to speed.

View 3 Replies View Related

Reference For SSIS C-like Script Needed

May 19, 2006

Consider the Conditional Split task. I can use a C-like language to create statements such as

Ltrim ([Col1] =€?A€?) || Ltrim([Col1] =€?B€?)


This sure ain€™t VB-like and the list of functions in the upper right-hand pane of the task (€œexpression editor€?) does not help me construct such statements.

Where is the reference manual describing this language?


TIA,

Barkingdog


P.S. I have found fragments in BOL but the info does not seem complete and the BOL topic fragmentation impedes learning.

P.P.S. Why MS uses this language instead of VB.NET, which they use in their Script tasks, is beyond me.

View 2 Replies View Related

Looking For An SSIS Reference Book Recommendation

Apr 30, 2007

We are getting prepared to move from SQL Server 2000 to 2005. We have a lot of DTS's that will need to be converted to SSIS. Can you recommend a really good reference book or text book on SSIS that will help us out both with DTS conversions as well as SSIS development in general.



thanks

View 1 Replies View Related

New 2005 SSIS Task: File Properties Task

Nov 7, 2007

A common issue that I run across with clients is they want only want to process a file if it's finished transmitting to the server. This SQL Server 2005 task reads the properties of a file and writes the values to a series of variables. For example, you can use this task to determine if the file is in use (still be uploaded or written to) and then conditionally run the Data Flow task to load the file if it's not being used. You can also use it to determine when the file was created in order to determine if it must be archived.

http://www.pragmaticworks.com/filepropertiestask.htm

View 5 Replies View Related

Add Reference To Excel In Scripting Tool In SSIS 2005

Sep 24, 2007

How can I add a reference to the Microsoft excel 2003 in the script tool in SSIS 2005? I need to automate Excel for formatting.
Thank you.

Dan

View 1 Replies View Related

SSIS Packages With Different Destination Databases... Removing Original DB Reference

Feb 26, 2007

Hi All,

OK, so I have an SSIS package that I build using the "test" database as the destination. Now I want to execute it using another database as the destination. This is basically for an installation script where the source is always the same, an access database.

So here I have:

"C:Program Files (x86)Microsoft SQL Server90DTSBinnDTExec.exe" /file e:data_import.dtsx /CONNECTION DestinationConnectionOLEDB;""Data Source=(local);Initial Catalog=Test2DB;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False;""

Which works (sort of). It does try to import the data into "Test2DB", but what happens is all of the destination tables in the dtsx package have names like [test1db].[dbo].[tablename]

So my question is: is there a way to remove the databasename reference in the table names for all 195 tables in my database without doing it manually?

Thanks in advance.

View 7 Replies View Related

Script Task Error --Object Reference Not Set To An Instance Of An Object

Sep 13, 2006

I am trying to execute this code feom Script task while excuting its giving me error that "Object reference not set to an instance of an object." The assemblies Iam referening in this code are there in GAC. Any idea abt this.



Thanks,

Public Sub Main()

Dim remoteUri As String

Dim fireAgain As Boolean

Dim uriVarName As String

Dim fileVarName As String

Dim httpConnection As Microsoft.SqlServer.Dts.Runtime.HttpClientConnection

Dim emptyBytes(0) As Byte

Dim SessionID As String

Dim CusAuth As CustomAuth

Try

' Determine the correct variables to read for URI and filename

uriVarName = "vsReportUri"

fileVarName = "vsReportDownloadFilename"

' create SessionID for use with HD Custom authentication

CusAuth = New CustomAuth(ASCIIEncoding.ASCII.GetBytes(Dts.Variables("in_vsBatchKey").Value.ToString()))



Dts.Variables(uriVarName).Value = Dts.Variables(uriVarName).Value.ToString() + "&" + _

"BeginDate=" + Dts.Variables("in_vsBeginDate").Value.ToString() + "&" + _

"EndDate=" + Dts.Variables("in_vsEndDate").Value.ToString()

Dim request As HttpWebRequest = CType(WebRequest.Create(Dts.Variables(uriVarName).Value.ToString()), HttpWebRequest)

'Set credentials based on the credentials found in the variables

request.Credentials = New NetworkCredential(Dts.Variables("in_vsReportUsername").Value.ToString(), _

Dts.Variables("in_vsReportPassword").Value.ToString(), _

Dts.Variables("in_vsReportDomain").Value.ToString())

'Place the custom authentication session ID in a cookie called BatchSession

request.CookieContainer.Add(New Cookie("BatchSession", CusAuth.GenerateSession("EmailAlertingSSIS"), "/", Dts.Variables("in_vsReportDomain").Value.ToString()))

' Set some reasonable limits on resources used by this request

request.MaximumAutomaticRedirections = 4

request.MaximumResponseHeadersLength = 4

' Prepare to download, write messages indicating download start

Dts.Events.FireInformation(0, String.Empty, String.Format("Downloading '{0}' from '{1}'", _

Dts.Variables(fileVarName).Value.ToString(), Dts.Variables(uriVarName).Value.ToString()), String.Empty, 0, fireAgain)

Dts.Log(String.Format("Downloading '{0}' from '{1}'", Dts.Variables(fileVarName).Value.ToString(), Dts.Variables(uriVarName).Value.ToString()), 0, emptyBytes)

' Download data

Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)

' Get the stream associated with the response.

Dim receiveStream As Stream = response.GetResponseStream()

' Pipes the stream to a higher level stream reader with the required encoding format.

Dim readStream As New StreamReader(receiveStream, Encoding.UTF8)

Dim fileStream As New StreamWriter(Dts.Variables(fileVarName).Value.ToString())

fileStream.Write(readStream.ReadToEnd())

fileStream.Flush()

fileStream.Close()

readStream.Close()

fileStream.Dispose()

readStream.Dispose()



'Download the file and report success

Dts.TaskResult = Dts.Results.Success

Catch ex As Exception

' post the error message we got back.

Dts.Events.FireError(0, String.Empty, ex.Message, String.Empty, 0)

Dts.TaskResult = Dts.Results.Failure

End Try

End Sub

View 1 Replies View Related

Getting Object Reference Not Set To An Instance Of An Object In Execute SQL Task

Jun 6, 2007



When I try and parse a simple execute of a stored procedure in the Execute SQL Task Editor, I get the error:



"Object reference not set to an instance of an object"



Now, I ONLY get this error on my laptop, so I'm assuming it might be an installation error. I've tried to do the exact same thing in other environments, and received no error. Here's what I'm doing:



1. I create a simple stored procedure on a SQL 2005 database. Here's what it does:



create proc usp_testsp

as

begin

select 'whatever' ;

end



2. I create a new SSIS package in BIS.

3. I create an ADO.NET connection to the above SQL 2005 database

4. I pull over an Execute SQL Task item from the toolbox to the Control Flow tab.

5. I choose the ADO.NET connectiontype, the connection I created in #2, SQLSourceType of Direct input, SQLStatement is: exec usp_testsp, IsQueryStoredProcedure set to True. And I try ResultSet as both Single row and None



When I try to Parse the Query, I get the above error. If I still try to run the task in the debugger, here's what I get with the ResultSet set to None:



Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "exec usp_testsp" failed with the following error: "Could not find stored procedure 'exec usp_testsp'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.



And just so you know, I can execute the sp with no problems. And just to check, I granted execute to public on the sp.



And here's what I get with ResultSet set to Single row:



Error: 0xC00291E2 at Execute SQL Task, Execute SQL Task: There is an invalid number of result bindings returned for the ResultSetType: "ResultSetType_SingleRow".



I only get this on my laptop. I have SQL Server 2005 SP2 Developer Edition on Windows XP Professional, SP2.



Thanks,

Michael





View 3 Replies View Related

EXECUTE SQL TASK --&&> Object Reference Not Set To An Instance Of An Object

Jun 27, 2007






Hi all,

Does anyone see the error below before?
I am using SSIS Execute SQL Task (ADO.NET) to update a table using a stored procedure.
It works like this many times for me and all of a sudden, not sure what is changing in the environment, I kept getting this WARNING when I click on PARSE QUERY
€œObject Reference Not Set to An Instance of an Object€? when I click on PARSE QUERY.

This is going against SQL SERVER 2005 SP2 x64 Enterprise.

Note that this task executes fine and the stored procedure updates data.

The stored procedure does the following.
There are other stored procedures of different kinds and they all worked.
But all of them give this error when I click on PARSE QUERY.




Code Snippet
DECLARE @TodayDate datetime
SET @TodayDate = GETDATE()

Exec dbo.updDimBatch
@BatchKey = @BatchKey,
@ParentBatchKey = @ParentBatchKey,
@BatchName = 'Load Customer Increment',
@BatchStartDate = NULL,
@BatchEndDate = @TodayDate,
@StatusKey = NULL,
@RowsInserted = @Count_Insert,
@RowsUpdated = @Count_Update,
@RowsException = NULL,
@RowsError = NULL,
@UpdatedDate = @TodayDate,
@BatchDescription = NULL

OLEDB Sample also give me syntax error

exec dbo.updDimBatch ?,?,'Load Activity Increment','6/27/2007','6/27/2007',1,?,?,0,0,'6/27/2007',''






I tried to change to OLEDB and call the stored procedure like this but got syntax error?

Not sure what is the error here.









View 2 Replies View Related

SQL 2012 :: DTSX Giving Errors - Object Reference Not Set To Instance Reference

Sep 10, 2014

I am using vs 2010 to write my dtsx import scripts.I use a script component as a source to create a flat file destination file.Everything have been working fine,but then my development machine crashed and we have to install everything again.Now when i use the execute package utility to test my scripts i get the following error:

Error system.NullReferenceException: Object refrence not set to an instance reference.

In PreExecute section
TextReader = new system.io.streamreader(" file name")
In the CreateNewOutputRows:
dim nextLine as string
nextLine = textReader.ReadLine

[code]...

is there something which i did not install or what can be the error?

View 0 Replies View Related

FTP Task: Object Reference Not Set To An Instance Of An Object.

Jun 19, 2006

I hit this error when I run the FTP task. I set IsRemotePathVariable = TRUE and RemoteVariable = User::FTPSourcePath where the variable is set with //DMFTP//PE1.JPG in the script task prior to FTP task.

IsLocalPathVariable also set to TRUE and LocalVariable = User::FTPTempPath where the variable is set to c:BiztalkFTPTemp

The FTP Operation is set to Receive Files.

I have tested the task with IsReportPathVariable to False and it works fine.

Can anyone help me and provide some advise on this? Thank you.

View 2 Replies View Related

SSIS Design : Object Reference Not Set To An Instance Of An Object

Jun 22, 2006

In visual studio 2005, I create a new Integration Services Project. It tries to create the first package by default "Package.dtsx". The "Package.dtsx[Design]" tab displays

Microsoft Visual Studio is unable to load this document

Object reference not set to an instance of an object

I try to create new SSIS package or edit an existing one (from tutorial), I get the same error in the SSIS graphical user interface tab.

Thanks for your help.

View 3 Replies View Related

SSIS - FTP Task

May 9, 2008

Sorry guys, I'm really new to this. Can somebody tell me the easiest way to use the FTP task with a dynamic local path. I just want the FTP task to send whatever file is in the directory I specify.

I'm creating a package that extracts data from a table to a pipe-delimited file. I then use an external process (since using Expressions for it was a nightmare) to rename the file so that it'll reflect the previous month (e.g. April2008_report.txt). Then, I have to FTP that file. That's where my problem is. It seems I need to specify the exact filename on the local path of the FTP task, and since the filename will change each month... well, you see my problem.

Is there a way to tell the FTP task to just send *.txt, or something to that effect?

Thanks in advance for you help!

Thanks,

Mark

View 5 Replies View Related

SSIS Task

Jun 21, 2006

Hi ,

I have a master database. Based on certain criteria's I will be creating one new database. Once I have finished the creation, I have to check the value of a particular column in both database tables.

This is actually a status check. if both are not equal i have to update detail database table column value with master column value.

I thought i can use lookup transform for this. The problem is master database table's status datatype and detail table's status datatype is diff.

Can anyone suggest me any other way for this problem?

thanks in advance.

View 1 Replies View Related

SSIS Task

Mar 26, 2008

In my package i am loading data from a flat file into multiple tables like table1, table2, table3 all tables have a column called cust_num.
But data for this column cust_num is only coming in table1 and i need to load the data from this column to other tables how can i do this.

View 4 Replies View Related

Need Help!!!! (SP Or SSIS Task)

Sep 6, 2007

I have written the Dynamic TSQL S-Proc. Below is what i wanted to implement in SSIS using foreach loop container as a cursor. But i am little doubtful whether I can achieve the dynamics to this level. I know everything is possible but is it advisable to go for this simple Sproc or SSIS tasks.

I have some 15 tables being populated using this SPROC.

Here is some helpful description
ENTITYNAME gives me the table i need to work
FIELDNAME gives me the field i have to work on
CHANGEDVALUE gives me the value changed in that field
( This three i get from source table which is about 9000 rows and containing 15 possible ENTITY to be work on and 100's of their respective FIELD )

while in Cursors i need to get using these above variables other variables like
FLAG
KeyName

Thrugh SQL1 I get the KeyValue

then using this KeyValue check if the data exist update else insert new data.

QUESTION: IS THIS ADVISABLE to go for SSIS task or just carry with SPROC?

/*******************************************************************************************************/



DECLARE Table_Cursor CURSOR
FOR SELECT ENTITYNAME,FIELDNAME, KEYID, CHANGEDVALUE, UPDATEUSER, UPDATEDATE
FROM dbo.ChangedDimensionStage

OPEN Table_cursor


FETCH NEXT FROM Table_cursor INTO @ENTITY, @FIELD, @KEYID, @VALUE, @USER, @DATE


WHILE @@FETCH_STATUS = 0



BEGIN

DECLARE @FLAG NVARCHAR(50);
SET @FLAG = (SELECT LEFT(@ENTITY, (SELECT CHARINDEX( 'DIM', @ENTITY) -1)) )+ 'LastUpdateFlag';

DECLARE @KeyName NVARCHAR(50);
SET @KeyName = (SELECT LEFT(@ENTITY, (SELECT CHARINDEX( 'DIM', @ENTITY) -1)) )+ 'Key'


DECLARE @KeyValue NVARCHAR(50)

DECLARE @SQL1 NVARCHAR (1000)

SET @SQL1 = N'Select @KeyValueOUT = '+ @KeyName + ' FROM DW_Integration.dbo.MangFact WHERE ClaKey = ' + @KEYID + ' GROUP BY ' + @KeyName + ' HAVING SUM(TotalClaCount) > 0 OR SUM(IncidentOnlyClaCount) > 0 '

EXECUTE sp_executesql @SQL1, N'@KeyValueOUT INT OUTPUT', @KeyValue OUTPUT;


DECLARE @WC_TABLE NVARCHAR(100)
SET @WC_TABLE = 'WorkingCopy' + @ENTITY

DECLARE @SQL2 nvarchar (1000);
SET @SQL2 = 'IF EXISTS (SELECT '+ @KeyName +' FROM ' + @WC_TABLE + ' WHERE ' + @KeyName + ' = ' + @KeyValue + ' )' +
' BEGIN UPDATE ' + @WC_TABLE + ' SET '+ @FIELD + ' = '''+ @VALUE + ''' WHERE ' + @KeyName + ' = ' + @KeyValue +'; END' +
' ELSE BEGIN
INSERT INTO '+ @WC_TABLE + ' SELECT * FROM DW_Integration.dbo.' + @ENTITY + ' WHERE ' + @Flag + ' = ' + '''Y''' + ' AND '+ @KeyName + ' = ' + @KeyValue + ';' +
'UPDATE ' + @WC_TABLE + ' SET '+ @FIELD + ' = '''+ @VALUE + ''' WHERE ' + @KeyName + ' = ' + @KeyValue +'; END'

EXECUTE sp_executesql @SQL2


FETCH NEXT FROM Table_cursor INTO @ENTITY, @FIELD, @KEYID, @VALUE, @USER, @DATE

END


CLOSE Table_cursor
DEALLOCATE Table_cursor

View 1 Replies View Related

FTP Task In SSIS

May 21, 2007



Hello,



I m having an FTP Task in SSIS project, from where I have downloaded .csv file.

And also having a Processed Folder in which the processed .csv files are kept.



Main task is to download file from FTP and check , if the date of downloaded file is newer than file in processed folder, then only process that file. Else skip the processing



Can anyone help me out how to process about.



plz reply as early as possible.



Thanks & Kind regards ....

Aparna





View 1 Replies View Related

SSIS Script Task

Jun 19, 2008

I have written a very basic Script Task using VS 2005, it just looks through a sqlDataReader and display a message.
I want this script to be triggered by an SQL Agent. I am not sure what to do from this point on. How do I publish or whatever it is called to get it to the SQL server or agent?
This is my very first attempt, no I have no clue what I am doing, will need lots of help and tutorials, thanks for reading.

View 1 Replies View Related

Script Task In Ssis

May 25, 2007

i am trying to generate a dynamic connection string using a variable 'servername'
i know where and how to do it but i am not sure abt the details of the paramenters that are to be passed in the script

and anyone give me a sample script

this is what iam trying to do

Public Sub Main()
'
Dts.Connections("SQL????").ConnectionString = "Data Source????" + Dts.Variables("servername").Value.ToString() + ???windows authentication and what else ????
'
Dts.TaskResult = Dts.Results.Success
End Sub

Thanks all

View 3 Replies View Related

SSIS Custom Task

Nov 19, 2007

Hi there,
I'm still pretty new to SSIS, what I am really battling with is getting a custom task to work.
I have developed a custom task, digitally signed it added it to the Global Assembly Cache, written the UI for it - Pretty much as it is done here: http://technet.microsoft.com/en-us/library/ms136080.aspx
but my problem is that when I drag it from the tool box into the control flow pane, I get this message: "The task user interface specified by type name 'XXXXXXXXXXXXXXXXXXX' could not be loaded.
(Microsoft.DatatransformationServices.Design).

Does anybody have an idea of what I am doing wrong here?


Duane.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved