SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
SQL Question
Goto page Previous  1, 2
 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
SQL Question
Author Message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Reply with quote
This is not a complete code you can run, this is just a code snippet. You need to add a declaration for "rows" variable, for example

Dim rows, number

and also database connect/disconnect commands and something to do with the retrieved data.
Thu Aug 02, 2007 1:53 pm View user's profile Send private message
mlr0911



Joined: 13 Jul 2007
Posts: 35
Country: United States

Post Reply with quote
Here is the complete code that I have

Code:

Dim exported_rows, Number
Dim message, String

Dim MySql,string

set MySql,"SELECT AC_BI.ACCOUNT_NUMBER, AC_BI.short_name, AC_BI.ADDRESS_01, AC_BI.ADDRESS_02 FROM SQLUser.AC_BI AC_BI"



// Every time this job runs it updates corresponding "run date"

// column in the AC_BI table

Dim rows, Number

Dim problem, Boolean

// connect to database described in the TRQ profile

DatabaseConnect( "TRP" )

// build data store and retrieve job record from the database

// we must include job_id in the syntax to allow updates

DatabaseRetrieve( mysql ,rows)

//NotEqual( rows, 1, problem )

IfThen( problem, stop )


// save copy of this table as a Excel 5 file

DatabaseSave( "C:\\test.xls", "xls", rows )
set message,"Complete"
// all done

DatabaseDisconnect

Exit

STOP:


It works fine with this, however, the "Set Mysql" statement that I need would be your code snippet example to do a more robust sql. However, when I use that snippet, it doesn't work.
Thu Aug 02, 2007 1:58 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7969

Post Reply with quote
Code:
Dim MySql, string
Dim rows, number
Dim message, String, "Invalid number of records found in table AC_BI"
Dim problem, Boolean


ConcatEx( "SELECT AC_BI.ACCOUNT_NUMBER, AC_BI.short_name, ", &
                 "AC_BI.ADDRESS_01, AC_BI.ADDRESS_02 ", &
          "FROM SQLUser.AC_BI AC_BI", &
          MySql )


// Every time this job runs it updates corresponding "run date"
// column in the AC_BI table

// connect to database described in the TRQ profile
DatabaseConnect( "TRP" )

// build data store and retrieve job record from the database
// we must include job_id in the syntax to allow updates
DatabaseRetrieve( mysql, rows)

NotEqual( rows, 1, problem )
IfThen( problem, STOP )


// save copy of this table as a Excel 5 file
DatabaseSave( "C:\\test.xls", "xls", rows )
Set( message, "Complete, data saved in C:\\test.xls file")
// all done

STOP:
DatabaseDisconnect
LogAddMessageEx( @V"job_id", "@V"job_name"", "INFO", message)

Thu Aug 02, 2007 2:20 pm View user's profile Send private message
mlr0911



Joined: 13 Jul 2007
Posts: 35
Country: United States

Post Reply with quote
Great!

Thanks for your help.
Thu Aug 02, 2007 3:13 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
Goto page Previous  1, 2
Page 2 of 2

 
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.