Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 SSIS with Scalar Function

Author  Topic 

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-10-18 : 11:50:25
I'm migrating data from one table to another (as is). I need to call a scalar function to return an ID (it has some crazy calculations to get what I'm looking for)...I need to then lookup the ID in the table I migrated to (i.e. both tables contain that ID). If the IDs match, i need to perform and update on the record. How do i do this with a scalar function in SSIS?

Example:

1. Scalar Function Results:

ID = 5

2. Table Record Data:

ID = 5

3.Update record with ID of 5 with some data.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-19 : 05:48:33
you can add a lookup task calling the scalar udf and then lookup to that.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-10-19 : 09:32:21
when i call the scalar function in the lookup i get "select statement must return at least one column"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-19 : 09:37:02
how are you calling it. can you show the used query?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-10-19 : 09:43:50
I'm really new at this (and this is probably wrong)...i was just doing exec dbo.ScalarFunctionName
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-19 : 09:47:50
nope use like

SELECT dbo.ScalarFunctionName(parameters) AS columnname

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Brittney10
Posting Yak Master

154 Posts

Posted - 2011-10-19 : 09:53:32
The scalar function just returns one variable @Variable....I need it to return a variable for every record to compare against. So i can't just hard code the param in there.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-19 : 09:56:58
then do it in a execute sql task

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -