populate database

M

Maileen

Hi,

I would like to populate my database with some test data.
for this i have a SQL file where are all my SQL requests.

Unfortunately I don't know how to run this SQL script (several SQL
statements in 1 file) under Access 2003.

How can i do that instead to copy/paste each of my SQL statement in SQL
window ?

--------------------------------
example of my file "script.sql" :
delete from EMPLOYEE;

delete from CUSTOMER;

insert into CUSTOMER (CUSTOMER_ID, CUSTOMER_NAME, CUSTOMER_DESCRIPTION)
values (2, "XLDA7PTXHKDUA
AIR5BNFIVYNMTYMTJNVQG64RXQ5GVTKY2JFBTWGX0E84IEDPN83P TQBSHAYOR9N02HMX
X44QMRY2VWAXXRIRCOOK
4V08V6014U7FMW8PV1A2TW9KCEA47JVXD0LRN1OWJ5MYA1WJUXWOVFG4KM
Q624LBOQ9N1LY75LU2E1942Y7EYHX23RJQ2E4N08LFNIEWUI18GO7UHR
M1RTH24JBHX3VTVJWLMR5RUHCQ86URO90", "DNM8LSEHFQ
NN3URLC1VU0H1D262N3O003QLLWHLKG4VPLMQW
YU38SKPVA1LO2EYW5BQ0983738MRNUSSQ1YKPPCIQ6CMUAOUKLMNL503OK6IKL3GM4PKRW6ICAVEVAEHNL2DUH4XQKEWHTGASPUX3YX
1DLII7
6AA1XT153WP21TBCJ96JF71PJ0B0QEU5WOOI825XQ2PFG9U745RDX9U5WPILYVXHML XRML
JKAFF908VO MA6CD2I F6");

insert into CUSTOMER (CUSTOMER_ID, CUSTOMER_NAME, CUSTOMER_DESCRIPTION)
values (3,
"HC2BGHKLJGK8LKV5OP0972Y81RER806E5PDQUDCKI9WSF44LW1KE2O608RH2T8UT4WTRIBLHV7WC4IV
DG6GX9R3EDF
6P7LNJU5BUUUBKTJ3NHAGA220C75Q6MGIX4E2QEIULKIL98PHIBQJGSP7K05MBYARCD3X5R6956KNP71Y3MWACEL0KFBKGL1JJOVWXMAG6YFKS4H
FIMFW9SO R69T7210L8VT5PYC2PO1VSMM1 WM820J5JJ4UG5DN", "7U46R7K
8BQHPNS8BMD42GNTGE5 Q2PX4PVFULRX31BKRABLA79AF3W9 MWNLEW7PH59FQ56S9GSWY
WJ16RR50 0DO67UINGW3NXHES9AIA6PXYQA1Y01TT9U8KLMADBEGHSXFD 5L2KTF50TGD
L95T0X O63YLAOT9I94OQDB
XYDX9NJETGW6MTIB8XM2MTMIW2NMN747W43D4KYY1NI94KD7U01S8L
N179DA5QWWN8QLR75VAYDWJQ2AN");


commit;
 
6

'69 Camaro

Hi, Maileen.
Unfortunately I don't know how to run this SQL script (several SQL
statements in 1 file) under Access 2003.

How can i do that instead to copy/paste each of my SQL statement in SQL
window ?

Jet can only parse and execute a single SQL statement at a time. You would
need to write your own "script reading engine" in VBA to open the file, read
the ASCII text, close the file, parse out individual SQL statements, then
create a transaction, then execute one SQL statement, then execute the next
parsed SQL statement, and the next -- one after another --and catch any
errors, then commit the transaction if all SQL statements were successfully
executed, or roll back the transaction if all SQL statements were not
successfully executed.

It would probably be faster to copy/paste each SQL statement into the SQL
View Pane and execute each individual query either manually or with a
user-defined VBA function.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
 
Top