Page 1 of 1

SQL query character limit

Posted: Tue May 03, 2016 8:57 am
by irshanuddin
Hello gurus,
We have a sql from a view that loads a table that we would like to bring in to our Datastage environment to have more control over it. The SQL itself is over 97,000 characters. It appears the character limits for User Defined SQL, Before SQL, After SQL and parameter string are all 64,000. This leaves us with the option of calling the script from a file, which we are trying to avoid due to some mishaps in the past where files got erased from the server.
Are we left with any other options?
We would like to keep the query intact and not have to break it up since it has loops in it and just rewriting to break it up would be a big job.

Thanks!

Posted: Tue May 03, 2016 9:32 am
by chulett
Not really... does it really need to be user defined? Curious also what you mean by "loops" in the SQL.

Posted: Tue May 03, 2016 10:20 am
by irshanuddin
So read from file, eh?
What I really meant was that it takes results from one query and outer joins to another and so on and so forth for 10 iterations to create groupings.
Still grappling with it, my first week at a new place. :shock:

Thanks!

Posted: Tue May 03, 2016 1:26 pm
by chulett
Can you put a view over all that, source from the view instead?

Posted: Tue May 03, 2016 3:04 pm
by irshanuddin
That's exactly what we are trying to replace, a view.

Looks like we will be reading from a file.
Thanks for your input.

Posted: Tue May 03, 2016 3:39 pm
by chulett
Okay... the view would hide all of the looping / iterations / grouping shenanigans from DataStage and just look like a straight select from a single table so seems to me it shouldn't really need to be any kind of 97K characters huge... but okay. :?

Posted: Tue May 03, 2016 9:54 pm
by kduke
The perfect example of doing too much in SQL. Break your SQL up into chunks. You are probably doing ranking. Do that SQL into lookups. Be creative. Learn the ETL tool. Quit relying on your SQL skills to do ETL.

Posted: Wed May 04, 2016 6:46 am
by johnboy3
Having less than one year with DataStage, and only part-time at that, I suspect this answer has value that I cannot quite Grok.

john3