The LoadData sample illustrates using SQLPrepare and SQLExecute to insert large amounts of data into Microsoft® SQL Server™ tables.
LoadData is a general-purpose utility for loading data not bound by native data formats or character restrictions onto a server running SQL Server.
The sample illustrates:
To build the application, you must ensure that 3.x versions of the ODBC header files and libraries are used, and that the SQL Server version 7.0 version of Odbcss.h is used.
The sample is a Microsoft Foundation Class dialog application. The application allows you to connect to a defined ODBC SQL Server data source and requires that you enter the name of a command file to process.
The command files of the LoadData sample application allow the user to tailor command processing by using the application. The application recognizes two commands:
The application treats strings enclosed in brackets ([]) as progress text and displays them in its progress pane as the application processes a command file.
Sample data, containing a command file, script file, and ANSI text data files are included.
[text]
ScriptRun "file_name"
LoadData "database..table", "file_name"
C:\Mssql7\Devtools\Samples\ODBC\Data\North
cd C:\Mssql7\Devtools\Samples\ODBC\Data\Northbcp Loaddata
When Loaddata.exe starts, connect to an ODBC data source, specify the location of the command file in the CommandFile window, and then click GO.
Loaddata.mak contains nmake configurations for ANSI and Unicode debug and release versions of the sample.
Build target | CFG parameter | Output directory |
---|---|---|
ANSI debug | “LoadData - Win32 Debug” | Debug |
ANSI release | “LoadData - Win32 Release” | Release |
Unicode debug | “LoadData - Win32 Unicode Debug” | Udebug |
Unicode release | “LoadData - Win32 Unicode Release” | Urelease |
SQLAllocHandle | SQLDriverConnect | SQLParamData |
SQLBindParameter | SQLExecDirect | SQLPrepare |
SQLCloseCursor | SQLExecute | SQLPutData |
SQLColAttribute | SQLFreeHandle | SQLSetConnectAttr |
SQLDataSources | SQLGetDiagField | SQLSetEnvAttr |
SQLDescribeCol | SQLGetDiagRec | SQLSetStmtAttr |
SQLDisconnect | SQLNumResultCols |