Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I execute multiple statements in SQL Server Compact 4?

I'm trying to get multiple inserts to work in a single script using the SQL Compact 4.0 Toolbox and not having any luck. I keep getting a parsing error.

I've even tried adding GO; between each statement like so..

INSERT INTO ... ;

GO;

INSERT INTO ... ;

with no luck.. so am I out of luck? Do I have to just execute each statement one at a time?

like image 671
Shane Courtrille Avatar asked Aug 07 '11 03:08

Shane Courtrille


People also ask

How run multiple statements in SQL Server?

To run a query with multiple statements, ensure that each statement is separated by a semicolon; then set the DSQEC_RUN_MQ global variable to 1 and run the query. When the variable is set to zero, all statements after the first semicolon are ignored.

What is Microsoft SQL Server Compact 4 used for?

Microsoft SQL Server Compact 4.0 is a free, embedded database that software developers can use for building ASP.NET websites and Windows desktop applications.

How do I run multiple scripts in Toad?

You can either go for f5 it will execute all the scrips on the tab. You can create a sql file and put all the insert statements in it and than give the file path in sql plus and execute. Save this answer.


1 Answers

Update to the latest release version (2.3). There was a bug with multiple statement execution, that has been fixed in the latest release version. Seperate each statement with GO on a separate line, no semicolon after... Like the INSERT statements created by the tool:

INSERT INTO [Shippers] ([Shipper ID],[Company Name]) VALUES (1,N'Speedy Express');
GO
INSERT INTO [Shippers] ([Shipper ID],[Company Name]) VALUES (2,N'United Package');
GO
INSERT INTO [Shippers] ([Shipper ID],[Company Name]) VALUES (3,N'Federal Shipping');
GO
like image 61
ErikEJ Avatar answered Sep 27 '22 18:09

ErikEJ