-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when reading SQL files #12
Labels
bug
Something isn't working
Comments
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! |
Tarmil
added a commit
that referenced
this issue
Dec 31, 2021
Released in v0.4. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:The text was updated successfully, but these errors were encountered: