Click here to Skip to main content
15,867,834 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi guys,

I have an sql file that i need to run from command line.

in sql file (please note that is small compared to real life sceanrios):

INSERT ALL
into table1 (column1,columnc1) VALUES (1,2)
into table1 (column1,columnc1) VALUES (3,4)
into table1 (column1,columnc1) VALUES (5,6)
into table1 (column1,columnc1) VALUES (7,8)
into table1 (column1,columnc1) VALUES (9,10)
SELECT * FROM DUAL;
COMMIT;


When im trying to pass this from cmd the folloing error will occur:
SP2-0734: unknown command beginning "into table1..." - rest of line ignored.
SP2-0734: unknown command beginning "into table1..." - rest of line ignored.
SP2-0734: unknown command beginning "into table1..." - rest of line ignored.
SP2-0734: unknown command beginning "into table1..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.


What I have tried:

Can someone tell me if there is a work around ?

Thanks for your help ! :)
Posted
Updated 4-Sep-18 3:14am
v2
Comments
Herman<T>.Instance 4-Sep-18 8:41am    
What database server are you using?



INSERT INTO Table1 (col1, col2) VALUES (x,y)

More help needed? https://www.google.nl/search?q=msdn+insert+into&oq=msdn+insert&aqs=chrome.1.69i57j0l5.3295j1j7&sourceid=chrome&ie=UTF-8
Joe Doe234 4-Sep-18 8:42am    
im using oracle
CHill60 4-Sep-18 9:13am    
What if you use
insert into table1 (column1,columnc1) VALUES (1,2)
insert into table1 (column1,columnc1) VALUES (3,4) ... etc
Joe Doe234 5-Sep-18 1:02am    
it will take time , i have found that you can make 1000 inserts into 1 query but i do not know how.
CHill60 5-Sep-18 4:31am    
how are you calling these commands?
and do you get the error immediately (i.e. if you just put these few lines into the file does it still fail)

1 solution

Shouldn't it be more like this?

SQL
INSERT INTO table ( col … ) VALUES
  ( row1 … ) 
, ( row2 … )
 …
 
Share this answer
 
Comments
Joe Doe234 5-Sep-18 1:02am    
i tried that but it is not possible it think that this is SQL syntax and i am using oracle.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900