Skip to content
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

SubString startIndex is one character off in the generated SQL #4018

Closed
francoisbeaussier opened this issue Dec 9, 2015 · 0 comments
Closed
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@francoisbeaussier
Copy link

Using 7.0.0-rc1-final

I have an NVARCHAR(50) column named Code and I'm trying to return the first character of that column.

The C# projection uses p => p.Code.Substring(0, 1) (In C#, SubString is 0 based so it made sense to me to pass 0 as the startIndex)

The generate SQL was SUBSTRING([m].[Code], 0, 1) which returns an empty string instead of returning the first character.

When playing with the generated SQL query and changing it to SUBSTRING([m].[Code], 1, 1), it behaves as expected, returning the first character.

Note: The current workaround is to use p => p.Code.Substring(1, 1) with a comment explaining why.

@rowanmiller rowanmiller added this to the 7.0.0-rc2 milestone Dec 15, 2015
@mikary mikary assigned mikary and unassigned smitpatel Dec 15, 2015
@mikary mikary closed this as completed in 2956098 Dec 16, 2015
@ajcvickers ajcvickers modified the milestones: 1.0.0-rc2, 1.0.0 Oct 15, 2022
@ajcvickers ajcvickers added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

5 participants