Siebel VB Language Reference > VB Language Reference >
SQLRetrieveToFile Function
This custom VB function fetches the results of a pending query on the connection specified by connection and stores them in the file specified by destination. NOTE: Siebel VB SQLxxxx functions are supported for non-Unicode databases only.
Syntax
SQLRetrieveToFile(connection, destination[, columnNames][, columnDelimiter])
|
|
connection |
The number returned by the SQLOpen function |
destination |
A string or string variable containing the filename and path to be used for storing the results |
columnNames |
One of the following values:
- nonzero = The first row contains the column headers as specified by the database schema
- 0 = The column headers are not retrieved
The default is 0. |
columnDelimiter |
The string to be used to delimit the fields in a row; if omitted, a Tab character is used |
Returns
If successful, a variant containing the number of rows in the result set; if unsuccessful, -1. Usage
The arguments must be named arguments. For information about named arguments, read Named Arguments and Call Statement. CAUTION: This function, as well as the other SQL functions available in Siebel VB, should not be used to query the underlying database. Use the Siebel Object Interfaces to query Siebel data. Use the SQL functions only to query non-Siebel data.
Example
This example opens a connection to a data source and retrieves information to a file. Sub Button_Click 'Declarations
Dim connection As Long Dim destination(1 To 50, 1 To 125) As Variant Dim retcode As long
'open the connection
connection = SQLOpen("DSN = SblTest",outputStr,prompt: = 3)
' Execute the query
query = "select * from customer" retcode = SQLExecQuery(connection,query)
'Place the results of the previous query in the file 'named by filename and put the column names in the file 'as the first row. 'The field delimiter is %
filename = "c:\myfile.txt" columnDelimiter = "%" retcode = SQLRetrieveToFile(connection: = connection, _ destination: = filename, columnNames: = 1, _ columnDelimiter: = columnDelimiter)
retcode = SQLClose(connection)
End Sub
Related Topics
SQLClose Function SQLError Function SQLExecQuery Function SQLGetSchema Function SQLOpen Function SQLRequest Function SQLRetrieve Function
|