Execute SQL Server Stored Procedure to Drop Index

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
mikesherm
Participant
Posts: 18
Joined: Thu Sep 17, 2009 12:25 pm

Execute SQL Server Stored Procedure to Drop Index

Post by mikesherm »

You folks have always been great in responding with quick and accurate info. Here's what I think is a fairly simple problem but I'm have trouble figuring out the answer:

I want to execute SQL Server stored procedures within a Job that will drop an index before a target table is loaded and then recreate the index after the target table is loaded. The stored procedures have been sucessfully tested in SQL Server and imported into the Datastage project.

I am trying to use the Stored Procedure stage but can't seem to configure it properly. Is this the proper stage to use and how do I configure
Any help would be appreciated.

Mike
Mike Sherman
Senior Consultant
Creative Computing, Inc.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Probably better to use the Open and Close commands in the ODBC Enterprise stage (or SQL Server Enterprise stage, if that's what you're using).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mikesherm
Participant
Posts: 18
Joined: Thu Sep 17, 2009 12:25 pm

Post by mikesherm »

Thanks, Ray. Just one more slightly stupid :lol: question.

Which command (Open or Close) do I set in the Source Enterprise Stage and which command do I set in the Target Enterprise Stage? Or can I set them in the same stage?

Mike
Mike Sherman
Senior Consultant
Creative Computing, Inc.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Open command to drop indexes, Close command to re-create indexes. Open command in either stage, Close command in target stage: I'd put them both in the target stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I would put both in the target stage, all though it may not ultimately matter, it just makes more sense for them to be in the stage working the same table.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mikesherm
Participant
Posts: 18
Joined: Thu Sep 17, 2009 12:25 pm

Post by mikesherm »

Excellent Ray!

The only reason I was confused is that the Information description for the Close Command in the stage is as follows:

SQL statement to be executed before insert array is processed. This statement is executed only once on the conductor node.

This certainly seems counter-intuitive to me.

Anyway, I'm good to go. Thanks a lot!

Mike
Mike Sherman
Senior Consultant
Creative Computing, Inc.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That would be a documentation bug, it would seem. Basically, the 'open' command is processed when the stage is 'opened' before any rows are processed, while the 'close' command is executed after all rows have been processed and just before the stage itself is closed.

Similar to the 'Before SQL' and 'After SQL' options other stages have.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply