SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
SQL answerset into variables

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
SQL answerset into variables
Author Message
Rick Ireland



Joined: 30 Oct 2000
Posts: 44

Post SQL answerset into variables Reply with quote

Hullo again

I need to issue a SQL select statement and have the answerset returned in the form of JAL variables.

We have a script that must rename input files based on a moderately sized MSAccess/Jet/SQL7 table. The sctipt must positionally isolate a 6-digit site-id field within the file name (done), build a SQL select statement using that value (done), query the database (uh-oh), read the full_practice_name value returned (yikes), build a new file using that variable (whew), and rename the file accordingly (done). There are any combination of 300 site-ids to test for.

I can write a simple VC++ program to do this, dumping the necessary data into a temp file, and then reading that file in using JAL, but that seems sort of barbaric.

Any ideas? Thanks in advance.

- Rick

Wed Nov 15, 2000 10:49 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7847

Post Re: SQL answerset into variables Reply with quote

It doesn't sound like a big deal.

Create Database Profile (Tools/Database Profiles menu) using ODBC as a DBMS

In the job script you will do something like the following:

Dim( rows, number )
Dim( row, number )
// connect to db
DatabaseConnect( "[profile name here]" )
// retrieve result set
DatabaseRetrieve( "[your sql here]", rows )
// go row by row, assuming that there is just one column in the output
Dim( full_practice_name, string )
ForNext( row, 1, rows, 1, NEXT )
// get the value for full_practice_name
DatabaseGet(row, 1, full_practice_name )
// build a new file using that variable
// .. put build logic here ...
NEXT:
// ... rename original file ...
// disconnect from db
DatabaseDisconnect( )

the fragment above assumes you retrieve many rows for evry file.
If you don't, remove ForNext loop and just do DatabaseGet(1, 1, full_practice_name )

If you are going to process many files in one script put DatabaseConnect and DatabaseDisconnect as the first and last line of the script. Do DatabaseRetrieve as many times as many files you process.

: Hullo again

: I need to issue a SQL select statement and have the answerset returned in the
: form of JAL variables.

: We have a script that must rename input files based on a moderately sized
: MSAccess/Jet/SQL7 table. The sctipt must positionally isolate a 6-digit
: site-id field within the file name (done), build a SQL select statement
: using that value (done), query the database (uh-oh), read the
: full_practice_name value returned (yikes), build a new file using that
: variable (whew), and rename the file accordingly (done). There are any
: combination of 300 site-ids to test for.

: I can write a simple VC++ program to do this, dumping the necessary data into
: a temp file, and then reading that file in using JAL, but that seems sort
: of barbaric.

: Any ideas? Thanks in advance.

: - Rick

Wed Nov 15, 2000 11:39 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.