473,473 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SQL Statement "Insert Into" Help Need

Dear NG - I've got a bunch of SQL statements (Insert Into "Access Table
Name") generated from another software program. They look like this:
Pasting these lines into the SQL view as they are generates a couple of
different errors (missing semicolon being one of them). They work fine
if I paste 1 line at a time. Can someone tell me what I need to do to
remedy the situation? I can't hardly paste 1 at a time! Your help is
very much appreciated.

Mike

insert into
test(BatchNo,BatchPgNo,BatchTrackID,CheckCounty,Ch eckDate,CheckDateFlag,CheckDateStatusCode,CheckSta tion,CheckStationFlag,CheckTimeStamp,City,county,C ountyFlag,CSID,DateOfBirth,Deer,DeerFlag,DLInterfa ce,FirstName,HarvestDate,HarvestDateFlag,HarvestTi meStamp,HrvstCheckStatus,HrvstDateStatusCode,Inval idKillCheck,LastName,Metal,MiddleInitial,Permit,Pe rmitFlag,Processed,State,TimeOfCheck,TimeOfHarvest ,Weapon,WeaponFlag,Zip,Vname,ScanGroup)
values (5948,0,"4008",40,#12/30/2006#,"0","Valid",8,"0",#12/30/2006
2:20:00 PM#,"Dayton","Jackson","0","00005948
1",#10/08/1980#,"Doe","0","RR243407","BENJAMIN",#12/30/2006#,"0",#12/30/2006
11:05:00
AM#,"0","Valid","0","SCHAAF",247962,"J","special", "0",#01/17/2007
12:24:03 PM#,"OH",#2:20 PM#,#11:05
AM#,"Muzzleloader","0",45420,"kinnard","ML")
insert into
test(BatchNo,BatchPgNo,BatchTrackID,CheckCounty,Ch eckDate,CheckDateFlag,CheckDateStatusCode,CheckSta tion,CheckStationFlag,CheckTimeStamp,City,county,C ountyFlag,CSID,DateOfBirth,Deer,DeerFlag,DLInterfa ce,FirstName,HarvestDate,HarvestDateFlag,HarvestTi meStamp,HrvstCheckStatus,HrvstDateStatusCode,Inval idKillCheck,LastName,Metal,MiddleInitial,Permit,Pe rmitFlag,Processed,State,TimeOfCheck,TimeOfHarvest ,Weapon,WeaponFlag,Zip,Vname,ScanGroup)
values (5948,1,"4008",40,#12/30/2006#,"0","Valid",8,"0",#12/30/2006
1:15:00 PM#,"Wellston","Jackson","0","00005948
2",#12/26/1946#,"Antlered","0","RQ468348","JAMES",#12/30/2006#,"0",#12/30/2006
10:00:00
AM#,"0","Valid","0","JOHNSON",247961,"C","owner"," 0",#01/17/2007
12:24:03 PM#,"OH",#1:15 PM#,#10:00
AM#,"Muzzleloader","0",45692,"kinnard","ML")

Jan 24 '07 #1
4 2493
Takeadoe wrote:
Dear NG - I've got a bunch of SQL statements (Insert Into "Access
Table Name") generated from another software program. They look like
this: Pasting these lines into the SQL view as they are generates a
couple of different errors (missing semicolon being one of them).
They work fine if I paste 1 line at a time. Can someone tell me what
I need to do to remedy the situation? I can't hardly paste 1 at a
time! Your help is very much appreciated.
An Access query cannot execute more than one statement.

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Jan 24 '07 #2
This should get you going in the right direction:
Sub RunSQL()
Const FileName = "C:\SQL.txt"
Dim intFile As Integer
Dim SQL As String
Dim Temp As String
intFile = FreeFile
Open FileName For Input As intFile
Do Until EOF(intFile)
Line Input #intFile, Temp
CurrentDb.Execute SQL
Loop
Close #intFile
End Sub
You can't execute more than one statement, so this routine reads from
the text file line by line, and executes each line.
Chris Nebinger
Takeadoe wrote:
Dear NG - I've got a bunch of SQL statements (Insert Into "Access Table
Name") generated from another software program. They look like this:
Pasting these lines into the SQL view as they are generates a couple of
different errors (missing semicolon being one of them). They work fine
if I paste 1 line at a time. Can someone tell me what I need to do to
remedy the situation? I can't hardly paste 1 at a time! Your help is
very much appreciated.

Mike

insert into
test(BatchNo,BatchPgNo,BatchTrackID,CheckCounty,Ch eckDate,CheckDateFlag,CheckDateStatusCode,CheckSta tion,CheckStationFlag,CheckTimeStamp,City,county,C ountyFlag,CSID,DateOfBirth,Deer,DeerFlag,DLInterfa ce,FirstName,HarvestDate,HarvestDateFlag,HarvestTi meStamp,HrvstCheckStatus,HrvstDateStatusCode,Inval idKillCheck,LastName,Metal,MiddleInitial,Permit,Pe rmitFlag,Processed,State,TimeOfCheck,TimeOfHarvest ,Weapon,WeaponFlag,Zip,Vname,ScanGroup)
values (5948,0,"4008",40,#12/30/2006#,"0","Valid",8,"0",#12/30/2006
2:20:00 PM#,"Dayton","Jackson","0","00005948
1",#10/08/1980#,"Doe","0","RR243407","BENJAMIN",#12/30/2006#,"0",#12/30/2006
11:05:00
AM#,"0","Valid","0","SCHAAF",247962,"J","special", "0",#01/17/2007
12:24:03 PM#,"OH",#2:20 PM#,#11:05
AM#,"Muzzleloader","0",45420,"kinnard","ML")
insert into
test(BatchNo,BatchPgNo,BatchTrackID,CheckCounty,Ch eckDate,CheckDateFlag,CheckDateStatusCode,CheckSta tion,CheckStationFlag,CheckTimeStamp,City,county,C ountyFlag,CSID,DateOfBirth,Deer,DeerFlag,DLInterfa ce,FirstName,HarvestDate,HarvestDateFlag,HarvestTi meStamp,HrvstCheckStatus,HrvstDateStatusCode,Inval idKillCheck,LastName,Metal,MiddleInitial,Permit,Pe rmitFlag,Processed,State,TimeOfCheck,TimeOfHarvest ,Weapon,WeaponFlag,Zip,Vname,ScanGroup)
values (5948,1,"4008",40,#12/30/2006#,"0","Valid",8,"0",#12/30/2006
1:15:00 PM#,"Wellston","Jackson","0","00005948
2",#12/26/1946#,"Antlered","0","RQ468348","JAMES",#12/30/2006#,"0",#12/30/2006
10:00:00
AM#,"0","Valid","0","JOHNSON",247961,"C","owner"," 0",#01/17/2007
12:24:03 PM#,"OH",#1:15 PM#,#10:00
AM#,"Muzzleloader","0",45692,"kinnard","ML")
Jan 24 '07 #3
BAH! I goofed on the subroutine. This would work better:
Sub RunSQL()
Const FileName = "C:\SQL.txt"
Dim intFile As Integer
Dim SQL As String
intFile = FreeFile
Open FileName For Input As intFile
Do Until EOF(intFile)
Line Input #intFile, SQL
CurrentDb.Execute SQL
Loop
Close #intFile
End Sub
Chris Nebinger

On Jan 24, 2:25 pm, "chris.nebin...@gmail.com"
<chris.nebin...@gmail.comwrote:
This should get you going in the right direction:

Sub RunSQL()
Const FileName = "C:\SQL.txt"
Dim intFile As Integer
Dim SQL As String
Dim Temp As String
intFile = FreeFile
Open FileName For Input As intFile
Do Until EOF(intFile)
Line Input #intFile, Temp
CurrentDb.Execute SQL
Loop
Close #intFile
End Sub

You can't execute more than one statement, so this routine reads from
the text file line by line, and executes each line.

Chris Nebinger

Takeadoe wrote:
Dear NG - I've got a bunch of SQL statements (Insert Into "Access Table
Name") generated from another software program. They look like this:
Pasting these lines into the SQL view as they are generates a couple of
different errors (missing semicolon being one of them). They work fine
if I paste 1 line at a time. Can someone tell me what I need to do to
remedy the situation? I can't hardly paste 1 at a time! Your help is
very much appreciated.
Mike
insert into
test(BatchNo,BatchPgNo,BatchTrackID,CheckCounty,Ch eckDate,CheckDateFlag,Che*ckDateStatusCode,CheckSt ation,CheckStationFlag,CheckTimeStamp,City,county, C*ountyFlag,CSID,DateOfBirth,Deer,DeerFlag,DLInter face,FirstName,HarvestDate,*HarvestDateFlag,Harves tTimeStamp,HrvstCheckStatus,HrvstDateStatusCode,In val*idKillCheck,LastName,Metal,MiddleInitial,Permi t,PermitFlag,Processed,State,*TimeOfCheck,TimeOfHa rvest,Weapon,WeaponFlag,Zip,Vname,ScanGroup)
values (5948,0,"4008",40,#12/30/2006#,"0","Valid",8,"0",#12/30/2006
2:20:00 PM#,"Dayton","Jackson","0","00005948
1",#10/08/1980#,"Doe","0","RR243407","BENJAMIN",#12/30/2006#,"0",#12/30/200*6
11:05:00
AM#,"0","Valid","0","SCHAAF",247962,"J","special", "0",#01/17/2007
12:24:03 PM#,"OH",#2:20 PM#,#11:05
AM#,"Muzzleloader","0",45420,"kinnard","ML")
insert into
test(BatchNo,BatchPgNo,BatchTrackID,CheckCounty,Ch eckDate,CheckDateFlag,Che*ckDateStatusCode,CheckSt ation,CheckStationFlag,CheckTimeStamp,City,county, C*ountyFlag,CSID,DateOfBirth,Deer,DeerFlag,DLInter face,FirstName,HarvestDate,*HarvestDateFlag,Harves tTimeStamp,HrvstCheckStatus,HrvstDateStatusCode,In val*idKillCheck,LastName,Metal,MiddleInitial,Permi t,PermitFlag,Processed,State,*TimeOfCheck,TimeOfHa rvest,Weapon,WeaponFlag,Zip,Vname,ScanGroup)
values (5948,1,"4008",40,#12/30/2006#,"0","Valid",8,"0",#12/30/2006
1:15:00 PM#,"Wellston","Jackson","0","00005948
2",#12/26/1946#,"Antlered","0","RQ468348","JAMES",#12/30/2006#,"0",#12/30/2*006
10:00:00
AM#,"0","Valid","0","JOHNSON",247961,"C","owner"," 0",#01/17/2007
12:24:03 PM#,"OH",#1:15 PM#,#10:00
AM#,"Muzzleloader","0",45692,"kinnard","ML")- Hide quoted text -- Show quoted text -
Jan 24 '07 #4
Chris - Thank you very much! That will be a very big help!

On Jan 24, 4:33 pm, "chris.nebin...@gmail.com"
<chris.nebin...@gmail.comwrote:
BAH! I goofed on the subroutine. This would work better:

Sub RunSQL()
Const FileName = "C:\SQL.txt"
Dim intFile As Integer
Dim SQL As String
intFile = FreeFile
Open FileName For Input As intFile
Do Until EOF(intFile)
Line Input #intFile, SQL
CurrentDb.Execute SQL
Loop
Close #intFile
End Sub

Chris Nebinger

On Jan 24, 2:25 pm, "chris.nebin...@gmail.com"

<chris.nebin...@gmail.comwrote:
This should get you going in the right direction:
Sub RunSQL()
Const FileName = "C:\SQL.txt"
Dim intFile As Integer
Dim SQL As String
Dim Temp As String
intFile = FreeFile
Open FileName For Input As intFile
Do Until EOF(intFile)
Line Input #intFile, Temp
CurrentDb.Execute SQL
Loop
Close #intFile
End Sub
You can't execute more than one statement, so this routine reads from
the text file line by line, and executes each line.
Chris Nebinger
Takeadoewrote:
Dear NG - I've got a bunch of SQL statements (Insert Into "Access Table
Name") generated from another software program. They look like this:
Pasting these lines into the SQL view as they are generates a couple of
different errors (missing semicolon being one of them). They work fine
if I paste 1 line at a time. Can someone tell me what I need to do to
remedy the situation? I can't hardly paste 1 at a time! Your help is
very much appreciated.
Mike
insert into
test(BatchNo,BatchPgNo,BatchTrackID,CheckCounty,Ch eckDate,CheckDateFlag,Che**ckDateStatusCode,CheckS tation,CheckStationFlag,CheckTimeStamp,City,county ,*C*ountyFlag,CSID,DateOfBirth,Deer,DeerFlag,DLInt erface,FirstName,HarvestDat*e,*HarvestDateFlag,Har vestTimeStamp,HrvstCheckStatus,HrvstDateStatusCode ,In*val*idKillCheck,LastName,Metal,MiddleInitial,P ermit,PermitFlag,Processed,St*ate,*TimeOfCheck,Tim eOfHarvest,Weapon,WeaponFlag,Zip,Vname,ScanGroup)
values (5948,0,"4008",40,#12/30/2006#,"0","Valid",8,"0",#12/30/2006
2:20:00 PM#,"Dayton","Jackson","0","00005948
1",#10/08/1980#,"Doe","0","RR243407","BENJAMIN",#12/30/2006#,"0",#12/30/200**6
11:05:00
AM#,"0","Valid","0","SCHAAF",247962,"J","special", "0",#01/17/2007
12:24:03 PM#,"OH",#2:20 PM#,#11:05
AM#,"Muzzleloader","0",45420,"kinnard","ML")
insert into
test(BatchNo,BatchPgNo,BatchTrackID,CheckCounty,Ch eckDate,CheckDateFlag,Che**ckDateStatusCode,CheckS tation,CheckStationFlag,CheckTimeStamp,City,county ,*C*ountyFlag,CSID,DateOfBirth,Deer,DeerFlag,DLInt erface,FirstName,HarvestDat*e,*HarvestDateFlag,Har vestTimeStamp,HrvstCheckStatus,HrvstDateStatusCode ,In*val*idKillCheck,LastName,Metal,MiddleInitial,P ermit,PermitFlag,Processed,St*ate,*TimeOfCheck,Tim eOfHarvest,Weapon,WeaponFlag,Zip,Vname,ScanGroup)
values (5948,1,"4008",40,#12/30/2006#,"0","Valid",8,"0",#12/30/2006
1:15:00 PM#,"Wellston","Jackson","0","00005948
2",#12/26/1946#,"Antlered","0","RQ468348","JAMES",#12/30/2006#,"0",#12/30/2**006
10:00:00
AM#,"0","Valid","0","JOHNSON",247961,"C","owner"," 0",#01/17/2007
12:24:03 PM#,"OH",#1:15 PM#,#10:00
AM#,"Muzzleloader","0",45692,"kinnard","ML")- Hide quoted text -- Show quoted text -- Hide quoted text -- Show quoted text -
Jan 25 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: newbie_mw | last post by:
Hi, I need urgent help with a novice problem. I would appreciate any advice, suggestions... Thanks a lot in advance! Here it is: I created a sign-up sheet (reg.html) where people fill in their...
2
by: EricRobineau | last post by:
hello I have a DB with many inter-related tables (MySQL) My main table called "content" has almost only foreign keys (integers) some have a 3 level relation (ex: content->city->region->country) ...
5
by: Chad Richardson | last post by:
Is there a way in SQL Server 2000 to extract data from a table, such that the result is a text file in the format of "Insert Into..." statements, i.e. if the table has 5 rows, the result would be 5...
2
by: CFW | last post by:
I use the following flawlessly to insert a single field: strSQL = "Insert into (Casket) Values " _ & "(" & conQuote & NewCasket & conQuote & ")" Set db = CurrentDb If MsgBox(NewCasket & " is...
6
by: Rich | last post by:
Hello, I have to create a table in an Access mdb (remotely) on the fly. Create Table tbl1(fld1 Integer, fld2 varchar(10), fld3...) Then I have to insert data: Insert Into tbl1 Values(" &...
20
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've...
0
by: crljenica | last post by:
I need to turn this select statement into a delete statemen. In other words, I want the results of the select statement deleted from the tables. I have never used a delete statement with a minus...
5
by: djsdaddy | last post by:
Good Day All, I have some EEO data in an old dBase4 database that I have converted to an Access table. Since dBase was not a relational database, I didn't create any key fields. I linked all of the...
6
by: ewpatton | last post by:
Good day, I've been trying to work with SQL and an Access database in order to handle custom user profiles. I haven't had any trouble reading from my database, but inserting new entries into...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.