Showing posts with label call. Show all posts
Showing posts with label call. Show all posts

Wednesday, March 28, 2012

How do I add a .DLL to my SSIS script task?

Hi,

I have some code written in .NET sitting in a .DLL. I would like to call this code from a script task block of code... but how do I add the .DLL to my project? If I go to References->Add References, there is no "Browse" button like there is in "normal" VS.NET. How can I add this .DLL? So far I have had to copy and paste the code from the .DLL into my project, but this is ugly!!

Thanks for any help.

Hi,

Refer this link: http://sqljunkies.com/WebLog/knight_reign/archive/2005/07/07/16018.aspx

|||

Thanks for your reply. However, I am now having problems trying to just add a .DLL to the GAC! I am following thse steps

1) goto .NET command line and type "sn -k SomeStrongName.snk" (it tells me the key was created)

2) add the this to the top of my code after imports, "<Assembly: AssemblyKeyFile("SomeStrongName.snk")> "

When I try to compile the .dll, it gives this error: "Error creating assembly manifest: Error reading key file 'SomeStrongName.snk' -- The system cannot find the file specified. "

Do you have any clue why this is happening? Is there somehwere i should move this .snk file to? Or do I have to change a path setting or something?

Any help is greatly appreciated!!!


|||I'd say the path is incorrect to the key. From memory something like ..\..\Keyfilename.snk worked best in VS 2003, but in VS 2005 just set the key in the Project Properties, Signing page, it saves all the hassle of specifying the AssembkykeyFile attribute by hand, it does it for you under the covers.

Monday, March 12, 2012

How can we call Function into Select qry ?

Hi ,
I need to call Function in Select Qry and some of the field of that Qry is
Input to
Function
like select Col1,col2, (select dbo.fn(Col1))Col3 from X
Any help Please ?
KrisKris wrote:
> Hi ,
> I need to call Function in Select Qry and some of the field of that
> Qry is Input to
> Function
> like select Col1,col2, (select dbo.fn(Col1))Col3 from X
> Any help Please ?
> Kris
Select
Col1, Col2, dbo.fn(Col1), Col3
From
X
Is that what you mean? If not, maybe what you're talking about is the
APPLY operator in SQL 2005 which allows you to add columns to a result
set based on the results of a function:
Select Col1, Col2
CROSS APPLY dbo.MyFunc(Col1)
David Gugick - SQL Server MVP
Quest Software|||David Thanks for your reply.
What I understand is, We can not use function into Select Qry, as function
suppose to return value for each records. I have to use Cursor.
Declare c1 -->select IdNum,(COl1+Col2)Col3 from X
read Value into @.Variable
select dbo.fn(@.Variable)
When I used Function in Select Qry. It is not returning value for all record
s,
select col1,col2, (select dbo.fn(col1+col2)) Col3 from X return Values
something like
Col1, Col2 ,Col3
A B AB
X Y AB
Is there any other way i can call fuction in select Qry becoz cursor is slow
.
Thx-Kris
"David Gugick" wrote:

> Kris wrote:
> Select
> Col1, Col2, dbo.fn(Col1), Col3
> From
> X
> Is that what you mean? If not, maybe what you're talking about is the
> APPLY operator in SQL 2005 which allows you to add columns to a result
> set based on the results of a function:
> Select Col1, Col2
> CROSS APPLY dbo.MyFunc(Col1)
>
> --
> David Gugick - SQL Server MVP
> Quest Software
>|||Kris (Kris@.discussions.microsoft.com) writes:
> David Thanks for your reply.
> What I understand is, We can not use function into Select Qry, as function
> suppose to return value for each records. I have to use Cursor.
> Declare c1 -->select IdNum,(COl1+Col2)Col3 from X
> read Value into @.Variable
> select dbo.fn(@.Variable)
> When I used Function in Select Qry. It is not returning value for all
> records,
> select col1,col2, (select dbo.fn(col1+col2)) Col3 from X return Values
> something like
> Col1, Col2 ,Col3
> A B AB
> X Y AB
> Is there any other way i can call fuction in select Qry becoz cursor is
> slow.
It's not fully clear what sort of function you have, but it seems like
you have a scalar function. In such case you can do:
SELECT col1, col2, dbo.fn(col1 + col2) AS Col3 FROM X
If you don't get back all rows as expected, you may have some other
problem with your actual query.
If you have a table-valued function, it depends on which version of
SQL whether you can do this in query or not.
It is difficult to assist when you don't give accurate information of
what you are doing. Could you include the actual code you are using?
Also, please specify which version of SQL Server you are using.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx