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,Ba tchPgNo,BatchTr ackID,CheckCoun ty,CheckDate,Ch eckDateFlag,Che ckDateStatusCod e,CheckStation, CheckStationFla g,CheckTimeStam p,City,county,C ountyFlag,CSID, DateOfBirth,Dee r,DeerFlag,DLIn terface,FirstNa me,HarvestDate, HarvestDateFlag ,HarvestTimeSta mp,HrvstCheckSt atus,HrvstDateS tatusCode,Inval idKillCheck,Las tName,Metal,Mid dleInitial,Perm it,PermitFlag,P rocessed,State, TimeOfCheck,Tim eOfHarvest,Weap on,WeaponFlag,Z ip,Vname,ScanGr oup)
values (5948,0,"4008", 40,#12/30/2006#,"0","Vali d",8,"0",#12/30/2006
2:20:00 PM#,"Dayton","J ackson","0","00 005948
1",#10/08/1980#,"Doe","0" ,"RR243407","BE NJAMIN",#12/30/2006#,"0",#12/30/2006
11:05:00
AM#,"0","Valid" ,"0","SCHAAF",2 47962,"J","spec ial","0",#01/17/2007
12:24:03 PM#,"OH",#2:20 PM#,#11:05
AM#,"Muzzleload er","0",45420," kinnard","ML")
insert into
test(BatchNo,Ba tchPgNo,BatchTr ackID,CheckCoun ty,CheckDate,Ch eckDateFlag,Che ckDateStatusCod e,CheckStation, CheckStationFla g,CheckTimeStam p,City,county,C ountyFlag,CSID, DateOfBirth,Dee r,DeerFlag,DLIn terface,FirstNa me,HarvestDate, HarvestDateFlag ,HarvestTimeSta mp,HrvstCheckSt atus,HrvstDateS tatusCode,Inval idKillCheck,Las tName,Metal,Mid dleInitial,Perm it,PermitFlag,P rocessed,State, TimeOfCheck,Tim eOfHarvest,Weap on,WeaponFlag,Z ip,Vname,ScanGr oup)
values (5948,1,"4008", 40,#12/30/2006#,"0","Vali d",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","own er","0",#01/17/2007
12:24:03 PM#,"OH",#1:15 PM#,#10:00
AM#,"Muzzleload er","0",45692," kinnard","ML") 4 2543
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
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.Execu te 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,Ba tchPgNo,BatchTr ackID,CheckCoun ty,CheckDate,Ch eckDateFlag,Che ckDateStatusCod e,CheckStation, CheckStationFla g,CheckTimeStam p,City,county,C ountyFlag,CSID, DateOfBirth,Dee r,DeerFlag,DLIn terface,FirstNa me,HarvestDate, HarvestDateFlag ,HarvestTimeSta mp,HrvstCheckSt atus,HrvstDateS tatusCode,Inval idKillCheck,Las tName,Metal,Mid dleInitial,Perm it,PermitFlag,P rocessed,State, TimeOfCheck,Tim eOfHarvest,Weap on,WeaponFlag,Z ip,Vname,ScanGr oup)
values (5948,0,"4008", 40,#12/30/2006#,"0","Vali d",8,"0",#12/30/2006
2:20:00 PM#,"Dayton","J ackson","0","00 005948
1",#10/08/1980#,"Doe","0" ,"RR243407","BE NJAMIN",#12/30/2006#,"0",#12/30/2006
11:05:00
AM#,"0","Valid" ,"0","SCHAAF",2 47962,"J","spec ial","0",#01/17/2007
12:24:03 PM#,"OH",#2:20 PM#,#11:05
AM#,"Muzzleload er","0",45420," kinnard","ML")
insert into
test(BatchNo,Ba tchPgNo,BatchTr ackID,CheckCoun ty,CheckDate,Ch eckDateFlag,Che ckDateStatusCod e,CheckStation, CheckStationFla g,CheckTimeStam p,City,county,C ountyFlag,CSID, DateOfBirth,Dee r,DeerFlag,DLIn terface,FirstNa me,HarvestDate, HarvestDateFlag ,HarvestTimeSta mp,HrvstCheckSt atus,HrvstDateS tatusCode,Inval idKillCheck,Las tName,Metal,Mid dleInitial,Perm it,PermitFlag,P rocessed,State, TimeOfCheck,Tim eOfHarvest,Weap on,WeaponFlag,Z ip,Vname,ScanGr oup)
values (5948,1,"4008", 40,#12/30/2006#,"0","Vali d",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","own er","0",#01/17/2007
12:24:03 PM#,"OH",#1:15 PM#,#10:00
AM#,"Muzzleload er","0",45692," kinnard","ML")
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.Execu te 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.Execu te 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,Ba tchPgNo,BatchTr ackID,CheckCoun ty,CheckDate,Ch eckDateFlag,Che *ckDateStatusCo de,CheckStation ,CheckStationFl ag,CheckTimeSta mp,City,county, C*ountyFlag,CSI D,DateOfBirth,D eer,DeerFlag,DL Interface,First Name,HarvestDat e,*HarvestDateF lag,HarvestTime Stamp,HrvstChec kStatus,HrvstDa teStatusCode,In val*idKillCheck ,LastName,Metal ,MiddleInitial, Permit,PermitFl ag,Processed,St ate,*TimeOfChec k,TimeOfHarvest ,Weapon,WeaponF lag,Zip,Vname,S canGroup)
values (5948,0,"4008", 40,#12/30/2006#,"0","Vali d",8,"0",#12/30/2006
2:20:00 PM#,"Dayton","J ackson","0","00 005948
1",#10/08/1980#,"Doe","0" ,"RR243407","BE NJAMIN",#12/30/2006#,"0",#12/30/200*6
11:05:00
AM#,"0","Valid" ,"0","SCHAAF",2 47962,"J","spec ial","0",#01/17/2007
12:24:03 PM#,"OH",#2:20 PM#,#11:05
AM#,"Muzzleload er","0",45420," kinnard","ML")
insert into
test(BatchNo,Ba tchPgNo,BatchTr ackID,CheckCoun ty,CheckDate,Ch eckDateFlag,Che *ckDateStatusCo de,CheckStation ,CheckStationFl ag,CheckTimeSta mp,City,county, C*ountyFlag,CSI D,DateOfBirth,D eer,DeerFlag,DL Interface,First Name,HarvestDat e,*HarvestDateF lag,HarvestTime Stamp,HrvstChec kStatus,HrvstDa teStatusCode,In val*idKillCheck ,LastName,Metal ,MiddleInitial, Permit,PermitFl ag,Processed,St ate,*TimeOfChec k,TimeOfHarvest ,Weapon,WeaponF lag,Zip,Vname,S canGroup)
values (5948,1,"4008", 40,#12/30/2006#,"0","Vali d",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","own er","0",#01/17/2007
12:24:03 PM#,"OH",#1:15 PM#,#10:00
AM#,"Muzzleload er","0",45692," kinnard","ML")- Hide quoted text -- Show quoted text -
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.Execu te 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.Execu te 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,Ba tchPgNo,BatchTr ackID,CheckCoun ty,CheckDate,Ch eckDateFlag,Che **ckDateStatusC ode,CheckStatio n,CheckStationF lag,CheckTimeSt amp,City,county ,*C*ountyFlag,C SID,DateOfBirth ,Deer,DeerFlag, DLInterface,Fir stName,HarvestD at*e,*HarvestDa teFlag,HarvestT imeStamp,HrvstC heckStatus,Hrvs tDateStatusCode ,In*val*idKillC heck,LastName,M etal,MiddleInit ial,Permit,Perm itFlag,Processe d,St*ate,*TimeO fCheck,TimeOfHa rvest,Weapon,We aponFlag,Zip,Vn ame,ScanGroup)
values (5948,0,"4008", 40,#12/30/2006#,"0","Vali d",8,"0",#12/30/2006
2:20:00 PM#,"Dayton","J ackson","0","00 005948
1",#10/08/1980#,"Doe","0" ,"RR243407","BE NJAMIN",#12/30/2006#,"0",#12/30/200**6
11:05:00
AM#,"0","Valid" ,"0","SCHAAF",2 47962,"J","spec ial","0",#01/17/2007
12:24:03 PM#,"OH",#2:20 PM#,#11:05
AM#,"Muzzleload er","0",45420," kinnard","ML")
insert into
test(BatchNo,Ba tchPgNo,BatchTr ackID,CheckCoun ty,CheckDate,Ch eckDateFlag,Che **ckDateStatusC ode,CheckStatio n,CheckStationF lag,CheckTimeSt amp,City,county ,*C*ountyFlag,C SID,DateOfBirth ,Deer,DeerFlag, DLInterface,Fir stName,HarvestD at*e,*HarvestDa teFlag,HarvestT imeStamp,HrvstC heckStatus,Hrvs tDateStatusCode ,In*val*idKillC heck,LastName,M etal,MiddleInit ial,Permit,Perm itFlag,Processe d,St*ate,*TimeO fCheck,TimeOfHa rvest,Weapon,We aponFlag,Zip,Vn ame,ScanGroup)
values (5948,1,"4008", 40,#12/30/2006#,"0","Vali d",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","own er","0",#01/17/2007
12:24:03 PM#,"OH",#1:15 PM#,#10:00
AM#,"Muzzleload er","0",45692," kinnard","ML")- Hide quoted text -- Show quoted text -- Hide quoted text -- Show quoted text -
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 first
name, last name, email, etc. The data are then sent to a PHP script
(reg.php). The data are then inserted into a table (reg) in MS SQL
server. I have declared the variables like this:
if (!(isset($_POST))) {
$FirstName = "" ;
|
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)
I would like admins to be able to insert new records including all the
"content" fields (in 1 page form)
But how can I make an insert form that would display the related
tables as list menus instead of a textfield with a number? (ex: select
|
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 lines of :
insert into Table (, , .... VALUES a,b,c)
insert into Table (, , .... VALUES d, e, f)
insert into Table (, , .... VALUES g, h, i)
insert into Table (, , .... VALUES j, k, l)
insert into Table (, , .... VALUES m, n, o)
|
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 not in the list. Do you want to add "
& NewCasket & _
" as a new Casket/Container in the list?", vbYesNo, _
"Add a Casket/Container") = vbYes Then
|
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(" & val1 & ", '" & val2 & "',...")"
| |
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 been doing something like
delete from foo where name = 'xx';
insert into foo values('xx',1,2,...);
|
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 command. Can anyone help.
SELECT item, ispecyr from itemlist where ispecyr = 79
minus
select b.piitem, a.cpspecyr from
contproj a, projitem b
where a.pcn = b.pcn
and cpspecyr = 79
|
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 tables together on Employees' SSN; therefore, in order to use this data with the current Access database, I need to create a relationship between the old dBase4 EEO data and the Access employee data. The Access employee data was also an old dBase...
|
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 it has been troublesome to
say the least.
My ASP.NET script is supposed to execute an INSERT INTO statement in
order to add a user to the database. Here is a sample:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |