To store recorded data in an Adaptive Server table by using bcp, you must first create a table for each view defined for the session. In the table, create a separate column for each of the data items that comprise the view. The first column for each table, which stores the date and time of the sample, must be of the datetime datatype.
If no data is returned for a view during a sample interval while Historical Server is recording, a placeholder record is written to the view’s data file. This record contains the timestamp of the sample followed by a comma-separated list of empty values. For this reason, it is recommended that all but the first column be defined to allow nulls.
You may simplify the process of creating tables by having the Historical Server create a script file for you. Use the script_type parameter of the hs_create_recording_session command.
After you create the table(s) on Adaptive Server, you can use the bcp utility to import data from the view data files to their respective tables. Run the following command once for each data file for which you want to import the data into an Adaptive Server table:
bcp [[database_name.]owner.]table_name in view_data_file -c [ -e errfile] [-U username] [-P password] [-S sqlserver] -t,
where:
database_name is the name of the database where the tables to hold the imported data are located.
owner is the name of the table’s owner (presumedly your own user name in the database that contains the table).
table_name is the name of the database table into which the data from the view’s data file is to be imported.
view_data_file is the name of the data file for the view.
errfile is the name of an error file in which any rows that could not be transferred to the database table are to be stored.
username is the login name to Adaptive Server.
password is the password of the username.
sqlserver is the name of Adaptive Server.
-t, specifies the column terminators as being commas.
The default row terminator when using the -c option is a \n (new line) character used by data files. Therefore, you do not need to specify the -r option. If you do specify the record terminator option (-r), be sure to avoid the special significance the backslash (\) character has by including another backslash, i.e., -r\\n.
For more information about bcp, see the Adaptive Server Utilities Guide.