Hi there,
I have the following tableA with data
Column1 Column2 Column3
How are you?
I am fine.
My goal is to convert this into a insert stament such as
INSERT INTO tableB (Column1, Column2, Column3)
VALUES ('How', 'are', 'you?');
INSERT INTO tableB (Column1, Column2, Column3)
VALUES ('I', 'am', 'fine?');
Here is the code.
All the dim statements and open file here.
I have this part working now.
'open file for writting
Open FileTex for Output as FileNo
Do While not rs.EOF
Print #FileNo, "INSERT INTO tableB ( "
For i = 0 To FieldCount
Print #FileNo, rs.Fields(i).Name & ", "
Print #FileNo, "VALUES " & "(" & rs.Fields(i).value & ", "
Next i
loop
This code displays the following:
INSERT INTO tableB(
Column1,
Column2,
Column3,
How could I display this in the same line with the close ")"?
I like to display in the same line for the INSERT statement and VALUES statement.
Thank you for your help.
I have the following tableA with data
Column1 Column2 Column3
How are you?
I am fine.
My goal is to convert this into a insert stament such as
INSERT INTO tableB (Column1, Column2, Column3)
VALUES ('How', 'are', 'you?');
INSERT INTO tableB (Column1, Column2, Column3)
VALUES ('I', 'am', 'fine?');
Here is the code.
All the dim statements and open file here.
I have this part working now.
'open file for writting
Open FileTex for Output as FileNo
Do While not rs.EOF
Print #FileNo, "INSERT INTO tableB ( "
For i = 0 To FieldCount
Print #FileNo, rs.Fields(i).Name & ", "
Print #FileNo, "VALUES " & "(" & rs.Fields(i).value & ", "
Next i
loop
This code displays the following:
INSERT INTO tableB(
Column1,
Column2,
Column3,
How could I display this in the same line with the close ")"?
I like to display in the same line for the INSERT statement and VALUES statement.
Thank you for your help.