December 5, 2014 at 7:51 am
I have asked this question in one of the other forums and one of users pointed this one out. He had a suggestion but wanted to see if someone else has something different to solve this problem.
Our DW runs on Netezza, connections have been established.
Hi,
I am pretty new working with SSIS, I was not sure if this is the right place to post a question, If it is not please forgive beforehand.
I have a store procedure that needs to be converted into an ETL package. The snippet of code that I am trying to deal with goes like this
LANGUAGE NZPLSQL AS
BEGIN_PROC
DECLARE
maxtrans integer ;
newtrans integer ;
BEGIN
IF SP_CHK_IF_TABLE_EXISTS('MY_TABLE_NAME')
THEN
maxtrans := NVL(MAX(transactionid),0) FROM 'MY_TABLE_NAME';
ELSE
maxtrans = 123456789;
END IF;
Basically it calls an existing SP to check if the table exists in the DB.
If it does exist it gets the Max transaction ID
If it does not exist assigns the maxtrans(transID)
Later down the execution of the package we will use the two variables set at the beginning of the stored procedure
select
column,
max(column) column,
max(column) column,
transactionid
from MYTABLE
where transactionid > 1234567
group by transactionid
Due to new management, we are migrating existing ETL that did some the work at a SP level and putting some of the work load into our ETL server.
Any help will be greatly appreciated and again, if I am in the wrong place I’d appreciate if you guys can direct me to the right forum
Thanks
December 5, 2014 at 8:11 am
What's your specific question please?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
December 5, 2014 at 8:33 am
Appears to be "how do i convert this sproc to an SSIS package"?
Steve.
December 5, 2014 at 9:48 am
How to change the SP to a SSIS package.
Establish 2 variables that the SP currently uses in IF statements
DECLARE
maxtrans integer ;
newtrans integer ;
IF SP_CHK_IF_TABLE_EXISTS('MYTABLE')
THEN
maxtrans := NVL(MAX(transactionid),0) FROM MYTABLE;
ELSE
maxtrans = 12345678;
END IF;
***builds a bunch of temp tables used to re-create the MYTABLE***
newtrans := MAX(transactionid) FROM MYTABLE;
IF newtrans > maxtrans
THEN
ELSE
delete from MYTABLE;
insert into MYTABLE values ('','','','','','','','','',now(),maxtrans,0,'');
END IF;
December 5, 2014 at 10:00 am
How much do you know about SSIS?
For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]
December 5, 2014 at 10:21 am
I am not an expert but can get around just fine.
I guess I am having a little trouble getting around the concept of variables in this case. I have set other simpler variables for the same package so far that go like this
If table "x" exist do this
If table "x" does not exist create temp tables as select "fields" from "tables" ...
Connections are not a problem.
February 12, 2015 at 8:09 pm
Why not simply query the Netezza system tables for the existence of said table? Set the integer to 1 if it is there and 0 if not.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply