You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
string.IsNullOrEmpty does not match C# version of string.IsNullOrEmpty for space only strings, MS SQL Server (actually it matches string.IsNulOrWhitespace))
#4138
Open
ldenis2 opened this issue
May 23, 2023
· 1 comment
· May be fixed by #4177
when you use in a query function like !string.IsNullOrEmpty it is converted to SQL like
SELECT
Count(*)
FROM
[Data$t11] [auto968]
WHERE
NOT ([auto968].[text] IS NULL OR Len([auto968].[text]) = 0)
and according to [https://learn.microsoft.com/en-us/sql/t-sql/functions/len-transact-sql?view=sql-server-ver16] LEN Returns the number of characters of the specified string expression, excluding trailing spaces. It means that string of space characters will not match the predicate. Please use DATALEN or fix it in a different proper way.
The text was updated successfully, but these errors were encountered:
ldenis2
changed the title
string.IsNullOrEmpty does not match C# version of string.IsNullOrEmpty for MS SQL Server (actually it matches string.IsNulOrWhitespace))
string.IsNullOrEmpty does not match C# version of string.IsNullOrEmpty for space only strings, MS SQL Server (actually it matches string.IsNulOrWhitespace))
May 23, 2023
Describe your issue
when you use in a query function like !string.IsNullOrEmpty it is converted to SQL like
SELECT
Count(*)
FROM
[Data$t11] [auto968]
WHERE
NOT ([auto968].[text] IS NULL OR Len([auto968].[text]) = 0)
and according to [https://learn.microsoft.com/en-us/sql/t-sql/functions/len-transact-sql?view=sql-server-ver16] LEN Returns the number of characters of the specified string expression, excluding trailing spaces. It means that string of space characters will not match the predicate. Please use DATALEN or fix it in a different proper way.
Steps to reproduce
Environment details
Linq To DB
version: 4.3.0Database (with version): SQL Server 2019
ADO.NET Provider (with version): Microsoft.Data.SqlClient 4.1.0
Operating system: Windows 10
.NET Version: net4.8
The text was updated successfully, but these errors were encountered: