Closed ivelten closed 2 years ago
This sounds like a byte order mark issue. The provider recognizes the encoding, but then provides the content of the file "as is", including BOM. We should strip the BOM.
@Tarmil yes you are right about that. If you don't mind, I could work on a Pull Request for it.
Sure, go ahead!
Released in v0.4.
I tried to use Text literal provider to load Sql files for queries using Dapper in F#. But I am having a strange behavior where the Sql file is loaded with a syntax error, altough the Sql file itself runs fine.
Trying to understand the problem, I copied the value of the Literal produced by the provider and pasted it into Sql Management Studio and tried executing it. I got the same syntax error:
SqlException: Incorrect syntax near ''.
Trying to understand the reason, I noticed that the Provider loads the Sql file with an unknown character before the first character. For example, a file with a content like
select * from dbo.Customers
is loaded with some unrecognized character before thes
fromselect
keyword.To reproduce the problem, you can simply try loading a Sql script file into the provider and try executing the literal generated by it's text into
SqlCommand
.For now, the workaround I am using is calling
Substring(1)
after the provider literal Text: