I have just discovered that SQL Server CE doesn’t allow you to batch queries. So given a large string of SQL statements i’m trying to split them out and then execute them individually. The problem is that some queries are seperated by a single line and others 2. For examples say i have the following query:
CREATE TABLE [Settings] (
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [nvarchar](100) NOT NULL,
[Value] [nvarchar](100) NULL
)
ALTER TABLE [Settings] ADD
CONSTRAINT [PK_Settings] PRIMARY KEY ([Id])
INSERT INTO [Settings] ([Name, [Value]) VALUES ('SiteUrl', 'http://localhost')
INSERT INTO [Settings] ([Name], [Value]) VALUES ('AssetsUrl', '/Assets')
I’d like to split each sql command into a string array. Appreciate the help. Thanks
This code split you big meat sql string to separete sql commands