I am writing a script to execute a bunch of SQL statements in the .NET 6 Application.
The script format looks like
SET IDENTITY_INSERT [dbo].[Books] ON
INSERT [dbo].[Books] ([id], [title], [script]) VALUES (783, 'Harry Potter', N'[{
"title": "Harry Potter" }]')
INSERT [dbo].[Books] ([id], [title], [script]) VALUES (784, 'Harry Potter 2', N'[{
"title": "Harry Potter 2" }]')
SET IDENTITY_INSERT [dbo].[Books] OFF
I am using the code to execute the dump script file
await context.Database.ExecuteSqlRawAsync(script);
When I executed it, it returns
Input string was not in a correct format
If I remove Json from SQL statement
N'[{ "title": "Harry Potter" }]'
Then it's executed fine. Can anyone help how to fix this issue?