SubString startIndex is one character off in the generated SQL #4018
Labels
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
Using 7.0.0-rc1-final
I have an
NVARCHAR(50)
column namedCode
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.The text was updated successfully, but these errors were encountered: