Funktions Zuordnungen des Microsoft SQL Server AnbietersFunction Mappings of the Microsoft SQL Server Provider

Diese Seite zeigt, welche .net-Member bei Verwendung des SQL Server Anbieters in welche SQL-Funktionen übersetzt werden.This page shows which .NET members are translated into which SQL functions when using the SQL Server provider.

Binäre FunktionenBinary functions

.NET.NET SQLSQL Hinzugefügt inAdded in
Satz. Enthält (Wert)bytes.Contains(value) CHARINDEX ( @value , @bytes ) > 0CHARINDEX(@value, @bytes) > 0 EF Core 5.0EF Core 5.0
Satz. First ()bytes.First() Teil Zeichenfolge ( @bytes , 1, 1)SUBSTRING(@bytes, 1, 1) EF Core 6.0EF Core 6.0
Satz. Füllbytes.Length DATALENGTH ( @bytes )DATALENGTH(@bytes) EF Core 5.0EF Core 5.0
Satz. SequenceEqual (Sekunde)bytes.SequenceEqual(second) @bytes = @second@bytes = @second EF Core 5.0EF Core 5.0
Bytes [i]bytes[i] Teil Zeichenfolge ( @bytes , @i + 1, 1)SUBSTRING(@bytes, @i + 1, 1) EF Core 6.0EF Core 6.0
EF. Functions. DATALENGTH (Arg)EF.Functions.DataLength(arg) DATALENGTH ( @arg )DATALENGTH(@arg) EF Core 5.0EF Core 5.0

KonvertierungsfunktionenConversion functions

.NET.NET SQLSQL Hinzugefügt inAdded in
Satz. Zeichenfolge ()bytes.ToString() Konvertieren (varchar (100), @bytes )CONVERT(varchar(100), @bytes)
ByteValue. Zeichenfolge ()byteValue.ToString() Konvertieren (varchar (3), @byteValue )CONVERT(varchar(3), @byteValue)
charvalue.-Zeichenfolge ()charValue.ToString() Konvertieren (varchar (1), @charValue )CONVERT(varchar(1), @charValue)
Konvertieren von "." (Wert)Convert.ToBoolean(value) Konvertieren (Bit, @value )CONVERT(bit, @value) EF Core 5.0EF Core 5.0
Convert. bybyte (Wert)Convert.ToByte(value) Convert (tinyint, @value )CONVERT(tinyint, @value)
Convert. $ Decimal (Wert)Convert.ToDecimal(value) Konvertieren (Decimal (18, 2), @value )CONVERT(decimal(18, 2), @value)
Konvertieren von "." (Wert)Convert.ToDouble(value) Konvertieren (float, @value )CONVERT(float, @value)
Convert. ToInt16 (Wert)Convert.ToInt16(value) Konvertieren (smallint, @value )CONVERT(smallint, @value)
Convert. ToInt32 (Wert)Convert.ToInt32(value) Konvertieren (int, @value )CONVERT(int, @value)
Convert. ToInt64 (Wert)Convert.ToInt64(value) Konvertieren (bigint, @value )CONVERT(bigint, @value)
Convert. $ String (Wert)Convert.ToString(value) Konvertieren (nvarchar (max), @value )CONVERT(nvarchar(max), @value)
DateTime.-Zeichenfolge ()dateTime.ToString() Konvertieren (varchar (100), @dateTime )CONVERT(varchar(100), @dateTime)
DateTimeOffset. ToString ()dateTimeOffset.ToString() Konvertieren (varchar (100), @dateTimeOffset )CONVERT(varchar(100), @dateTimeOffset)
DecimalValue. destring ()decimalValue.ToString() Konvertieren (varchar (100), @decimalValue )CONVERT(varchar(100), @decimalValue)
DoubleValue.-Zeichenfolge ()doubleValue.ToString() Konvertieren (varchar (100), @doubleValue )CONVERT(varchar(100), @doubleValue)
floatvalue.-Zeichenfolge ()floatValue.ToString() Konvertieren (varchar (100), @floatValue )CONVERT(varchar(100), @floatValue)
GUID. Zeichenfolge ()guid.ToString() Konvertieren (varchar (36), @guid )CONVERT(varchar(36), @guid)
intvalue.-Zeichenfolge ()intValue.ToString() Konvertieren (varchar (11), @intValue )CONVERT(varchar(11), @intValue)
longValue.-Zeichenfolge ()longValue.ToString() Konvertieren (varchar (20), @longValue )CONVERT(varchar(20), @longValue)
sByteValue. destring ()sbyteValue.ToString() Konvertieren (varchar (4), @sbyteValue )CONVERT(varchar(4), @sbyteValue)
shortValue.-Zeichenfolge ()shortValue.ToString() Konvertieren (varchar (6), @shortValue )CONVERT(varchar(6), @shortValue)
TimeSpan.-Zeichenfolge ()timeSpan.ToString() Konvertieren (varchar (100), @timeSpan )CONVERT(varchar(100), @timeSpan)
uintvalue.-Zeichenfolge ()uintValue.ToString() Konvertieren (varchar (10), @uintValue )CONVERT(varchar(10), @uintValue)
uLongValue.-Zeichenfolge ()ulongValue.ToString() Konvertieren (varchar (19), @ulongValue )CONVERT(varchar(19), @ulongValue)
uShortValue.-Zeichenfolge ()ushortValue.ToString() Konvertieren (varchar (5), @ushortValue )CONVERT(varchar(5), @ushortValue)

Datums- und UhrzeitfunktionenDate and time functions

.NET.NET SQLSQL Hinzugefügt inAdded in
DateTime.NowDateTime.Now GETDATE ()GETDATE()
DateTime. heuteDateTime.Today Convert (Date, GETDATE ())CONVERT(date, GETDATE())
DateTime.UtcNowDateTime.UtcNow GETUTCDATE ()GETUTCDATE()
DateTime. AddDays (Wert)dateTime.AddDays(value) DateAdd (Tag, @value , @dateTime )DATEADD(day, @value, @dateTime)
DateTime. AddHours (Wert)dateTime.AddHours(value) DateAdd (Stunde, @value , @dateTime )DATEADD(hour, @value, @dateTime)
DateTime. AddMilliseconds (Wert)dateTime.AddMilliseconds(value) DateAdd (Millisekunde, @value , @dateTime )DATEADD(millisecond, @value, @dateTime)
DateTime. AddMinutes (Wert)dateTime.AddMinutes(value) DateAdd (Minute, @value , @dateTime )DATEADD(minute, @value, @dateTime)
DateTime. addmonate (Monate)dateTime.AddMonths(months) DateAdd (Monat, @months , @dateTime )DATEADD(month, @months, @dateTime)
DateTime. AddSeconds (Wert)dateTime.AddSeconds(value) DateAdd (Second, @value , @dateTime )DATEADD(second, @value, @dateTime)
DateTime. AddYears (Wert)dateTime.AddYears(value) DateAdd (Jahr, @value , @dateTime )DATEADD(year, @value, @dateTime)
DateTime. DatedateTime.Date Konvertieren (Datum, @dateTime )CONVERT(date, @dateTime)
DateTime. DaydateTime.Day DatePart (Tag, @dateTime )DATEPART(day, @dateTime)
DateTime. dayosyeardateTime.DayOfYear DatePart (dayosyear, @dateTime )DATEPART(dayofyear, @dateTime)
DateTime. HourdateTime.Hour DatePart (Stunde, @dateTime )DATEPART(hour, @dateTime)
DateTime. MillisekundedateTime.Millisecond DatePart (Millisekunde, @dateTime )DATEPART(millisecond, @dateTime)
DateTime. MinutedateTime.Minute DatePart (Minute, @dateTime )DATEPART(minute, @dateTime)
DateTime. MonthdateTime.Month DatePart (Monat, @dateTime )DATEPART(month, @dateTime)
DateTime. SeconddateTime.Second DatePart (Sekunde, @dateTime )DATEPART(second, @dateTime)
DateTime. TimeOfDaydateTime.TimeOfDay Konvertieren (Zeit, @dateTime )CONVERT(time, @dateTime) EF Core 2.2EF Core 2.2
DateTime. YeardateTime.Year DatePart (Jahr, @dateTime )DATEPART(year, @dateTime)
DateTimeOffset.NowDateTimeOffset.Now SYSDATETIMEOFFSET ()SYSDATETIMEOFFSET()
DateTimeOffset. UtcNowDateTimeOffset.UtcNow SYSUTCDATETIME ()SYSUTCDATETIME()
DateTimeOffset. AddDays (Tage)dateTimeOffset.AddDays(days) DateAdd (Tag, @days , @dateTimeOffset )DATEADD(day, @days, @dateTimeOffset)
DateTimeOffset. AddHours (Stunden)dateTimeOffset.AddHours(hours) DateAdd (Stunde, @hours , @dateTimeOffset )DATEADD(hour, @hours, @dateTimeOffset)
DateTimeOffset. AddMilliseconds (Millisekunden)dateTimeOffset.AddMilliseconds(milliseconds) DateAdd (Millisekunde, @milliseconds , @dateTimeOffset )DATEADD(millisecond, @milliseconds, @dateTimeOffset)
DateTimeOffset. AddMinutes (Minuten)dateTimeOffset.AddMinutes(minutes) DateAdd (Minute, @minutes , @dateTimeOffset )DATEADD(minute, @minutes, @dateTimeOffset)
DateTimeOffset. addmonate (Monate)dateTimeOffset.AddMonths(months) DateAdd (Monat, @months , @dateTimeOffset )DATEADD(month, @months, @dateTimeOffset)
DateTimeOffset. AddSeconds (Sekunden)dateTimeOffset.AddSeconds(seconds) DateAdd (Second, @seconds , @dateTimeOffset )DATEADD(second, @seconds, @dateTimeOffset)
DateTimeOffset. AddYears (Jahre)dateTimeOffset.AddYears(years) DateAdd (Jahr, @years , @dateTimeOffset )DATEADD(year, @years, @dateTimeOffset)
DateTimeOffset. DatedateTimeOffset.Date Konvertieren (Datum, @dateTimeOffset )CONVERT(date, @dateTimeOffset)
DateTimeOffset. DaydateTimeOffset.Day DatePart (Tag, @dateTimeOffset )DATEPART(day, @dateTimeOffset)
DateTimeOffset. dayosyeardateTimeOffset.DayOfYear DatePart (dayosyear, @dateTimeOffset )DATEPART(dayofyear, @dateTimeOffset)
DateTimeOffset. HourdateTimeOffset.Hour DatePart (Stunde, @dateTimeOffset )DATEPART(hour, @dateTimeOffset)
DateTimeOffset. MillisekundedateTimeOffset.Millisecond DatePart (Millisekunde, @dateTimeOffset )DATEPART(millisecond, @dateTimeOffset)
DateTimeOffset. MinutedateTimeOffset.Minute DatePart (Minute, @dateTimeOffset )DATEPART(minute, @dateTimeOffset)
DateTimeOffset. MonthdateTimeOffset.Month DatePart (Monat, @dateTimeOffset )DATEPART(month, @dateTimeOffset)
DateTimeOffset. SeconddateTimeOffset.Second DatePart (Sekunde, @dateTimeOffset )DATEPART(second, @dateTimeOffset)
DateTimeOffset. TimeOfDaydateTimeOffset.TimeOfDay Konvertieren (Zeit, @dateTimeOffset )CONVERT(time, @dateTimeOffset) EF Core 2.2EF Core 2.2
DateTimeOffset. YeardateTimeOffset.Year DatePart (Jahr, @dateTimeOffset )DATEPART(year, @dateTimeOffset)
EF. Functions. DateDiffDay (Start, Ende)EF.Functions.DateDiffDay(start, end) DateDiff (Tag, @start , @end )DATEDIFF(day, @start, @end)
EF. Functions. DateDiffHour (Start, Ende)EF.Functions.DateDiffHour(start, end) DateDiff (Stunde, @start , @end )DATEDIFF(hour, @start, @end)
EF. Functions. datediffmikro Second (Start, Ende)EF.Functions.DateDiffMicrosecond(start, end) DateDiff (Mikrosekunden, @start , @end )DATEDIFF(microsecond, @start, @end)
EF. Functions. DateDiffMillisecond (Start, Ende)EF.Functions.DateDiffMillisecond(start, end) DateDiff (Millisekunde, @start , @end )DATEDIFF(millisecond, @start, @end)
EF. Functions. DateDiffMinute (Start, Ende)EF.Functions.DateDiffMinute(start, end) DateDiff (Minute, @start , @d2 )DATEDIFF(minute, @start, @d2)
EF. Functions. DateDiffMonth (Start, Ende)EF.Functions.DateDiffMonth(start, end) DateDiff (Monat, @start , @end )DATEDIFF(month, @start, @end)
EF. Functions. DateDiffNanosecond (Start, Ende)EF.Functions.DateDiffNanosecond(start, end) DateDiff (Nanosecond, @start , @end )DATEDIFF(nanosecond, @start, @end)
EF. Functions. DateDiffSecond (Start, Ende)EF.Functions.DateDiffSecond(start, end) DateDiff (Sekunde, @start , @end )DATEDIFF(second, @start, @end)
EF. Functions. datediffweek (Start, Ende)EF.Functions.DateDiffWeek(start, end) DateDiff (Woche, @start , @end )DATEDIFF(week, @start, @end) EF Core 5.0EF Core 5.0
EF. Functions. DateDiffYear (Start, Ende)EF.Functions.DateDiffYear(start, end) DateDiff (Jahr, @start , @end )DATEDIFF(year, @start, @end)
EF. Functions. datefromparts (Jahr, Monat, Tag)EF.Functions.DateFromParts(year, month, day) Datefromparts ( @year , @month , @day )DATEFROMPARTS(@year, @month, @day) EF Core 5.0EF Core 5.0
EF. Functions. DateTime2FromParts (Jahr, Monat, Tag,...)EF.Functions.DateTime2FromParts(year, month, day, ...) DATETIME2FROMPARTS ( @year , @month , @day ,...)DATETIME2FROMPARTS(@year, @month, @day, ...) EF Core 5.0EF Core 5.0
EF. Functions. datetimefromparts (Jahr, Monat, Tag,...)EF.Functions.DateTimeFromParts(year, month, day, ...) Datetimefromparts ( @year , @month , @day ,...)DATETIMEFROMPARTS(@year, @month, @day, ...) EF Core 5.0EF Core 5.0
EF. Functions. datetimeoffsetfromparts (Jahr, Monat, Tag,...)EF.Functions.DateTimeOffsetFromParts(year, month, day, ...) Datetimeoffsetfromparts ( @year , @month , @day ,...)DATETIMEOFFSETFROMPARTS(@year, @month, @day, ...) EF Core 5.0EF Core 5.0
EF. Functions. IsDate (Ausdruck)EF.Functions.IsDate(expression) IsDate ( @expression )ISDATE(@expression) EF Core 3.0EF Core 3.0
EF. Functions. smalldatetimefromparts (Jahr, Monat, Tag,...)EF.Functions.SmallDateTimeFromParts(year, month, day, ...) Smalldatetimefromparts ( @year , @month , @day ,...)SMALLDATETIMEFROMPARTS(@year, @month, @day, ...) EF Core 5.0EF Core 5.0
EF. Functions. timefromparts (Stunde, Minute, Sekunde,...)EF.Functions.TimeFromParts(hour, minute, second, ...) Timefromparts ( @hour , @minute , @second ,...)TIMEFROMPARTS(@hour, @minute, @second, ...) EF Core 5.0EF Core 5.0
TimeSpan. HourstimeSpan.Hours DatePart (Stunde, @timeSpan )DATEPART(hour, @timeSpan) EF Core 5.0EF Core 5.0
TimeSpan. MillisekundentimeSpan.Milliseconds DatePart (Millisekunde, @timeSpan )DATEPART(millisecond, @timeSpan) EF Core 5.0EF Core 5.0
TimeSpan. MinutestimeSpan.Minutes DatePart (Minute, @timeSpan )DATEPART(minute, @timeSpan) EF Core 5.0EF Core 5.0
TimeSpan. secondstimeSpan.Seconds DatePart (Sekunde, @timeSpan )DATEPART(second, @timeSpan) EF Core 5.0EF Core 5.0

Numerische FunktionenNumeric functions

.NET.NET SQLSQL Hinzugefügt inAdded in
EF. Functions. Random ()EF.Functions.Random() Rand ()RAND() EF Core 6.0EF Core 6.0
Math. Abs (Wert)Math.Abs(value) Abs ( @value )ABS(@value)
Math. acos (d)Math.Acos(d) Acos ( @d )ACOS(@d)
Math. Asin (d)Math.Asin(d) ASIN ( @d )ASIN(@d)
Math. Atan (d)Math.Atan(d) Atan ( @d )ATAN(@d)
Math. atan2 (y, x)Math.Atan2(y, x) ATN2 ( @y , @x )ATN2(@y, @x)
Math. Ceiling (d)Math.Ceiling(d) Ceiling ( @d )CEILING(@d)
Math. cos (d)Math.Cos(d) COS ( @d )COS(@d)
Math. Exp (d)Math.Exp(d) Exp ( @d )EXP(@d)
Math. Floor (d)Math.Floor(d) Floor ( @d )FLOOR(@d)
Math. log (d)Math.Log(d) Log ( @d )LOG(@d)
Math. log (a, NEWBASE)Math.Log(a, newBase) Log ( @a , @newBase )LOG(@a, @newBase)
Math. log10 (d)Math.Log10(d) Log10 ( @d )LOG10(@d)
Math. Pow (x, y)Math.Pow(x, y) Power ( @x , @y )POWER(@x, @y)
Math. Round (d)Math.Round(d) Round ( @d , 0)ROUND(@d, 0)
Math. Round (d, Dezimalstellen)Math.Round(d, decimals) Round ( @d , @decimals )ROUND(@d, @decimals)
Math. Sign (Wert)Math.Sign(value) Sign ( @value )SIGN(@value)
Math. Sin (a)Math.Sin(a) Sin ( @a )SIN(@a)
Math. sqrt (d)Math.Sqrt(d) SQRT ( @d )SQRT(@d)
Math. Tan (a)Math.Tan(a) Tan ( @a )TAN(@a)
Math. Truncate (d)Math.Truncate(d) Round ( @d , 0,0)ROUND(@d, 0, 1)

ZeichenfolgenfunktionenString functions

.NET.NET SQLSQL Hinzugefügt inAdded in
EF. Functions. COLLATE (Operand, COLLATIONS)EF.Functions.Collate(operand, collation) @operand COLLATE @collation@operand COLLATE @collation EF Core 5.0EF Core 5.0
EF. Functions. enthält (PropertyReference, SearchCondition)EF.Functions.Contains(propertyReference, searchCondition) Enthält ( @propertyReference , @searchCondition )CONTAINS(@propertyReference, @searchCondition) EF Core 2.2EF Core 2.2
EF. Functions. enthält (PropertyReference, SearchCondition, languageterm)EF.Functions.Contains(propertyReference, searchCondition, languageTerm) enthält ( @propertyReference , @searchCondition , Sprache @languageTerm )CONTAINS(@propertyReference, @searchCondition, LANGUAGE @languageTerm) EF Core 2.2EF Core 2.2
EF. Functions. fretext (PropertyReference, fretext)EF.Functions.FreeText(propertyReference, freeText) Freitext ( @propertyReference , @freeText )FREETEXT(@propertyReference, @freeText)
EF. Functions. fretext (PropertyReference, fretext, languageterm)EF.Functions.FreeText(propertyReference, freeText, languageTerm) Freitext ( @propertyReference , @freeText , Sprache @languageTerm )FREETEXT(@propertyReference, @freeText, LANGUAGE @languageTerm)
EF. Functions. ISNUMERIC (Ausdruck)EF.Functions.IsNumeric(expression) ISNUMERIC ( @expression )ISNUMERIC(@expression) EF Core 6.0EF Core 6.0
EF. Functions. like (MatchExpression, Pattern)EF.Functions.Like(matchExpression, pattern) @matchExpression mögen @pattern@matchExpression LIKE @pattern
EF. Functions. like (MatchExpression, pattern, escapecharacter)EF.Functions.Like(matchExpression, pattern, escapeCharacter) @matchExpression LIKE- @pattern Escape @escapeCharacter@matchExpression LIKE @pattern ESCAPE @escapeCharacter
String. Compare (Stra, strB)string.Compare(strA, strB) Fall, wenn @strA = @strB Then 0... SchließlichCASE WHEN @strA = @strB THEN 0 ... END
Schnür. Concat (str0, str1)string.Concat(str0, str1) @str0 + @str1@str0 + @str1
Schnür. IsNullOrEmpty (Wert)string.IsNullOrEmpty(value) @value ist NULL oder @value like N ' '.@value IS NULL OR @value LIKE N''
Schnür. IsNullOrWhiteSpace (Wert)string.IsNullOrWhiteSpace(value) @value ist NULL oder LTrim (RTrim ( @value )) = N ' '@value IS NULL OR LTRIM(RTRIM(@value)) = N''
StringValue. CompareTo (Straub)stringValue.CompareTo(strB) Fall, wenn @stringValue = @strB Then 0... SchließlichCASE WHEN @stringValue = @strB THEN 0 ... END
StringValue. enthält (Wert)stringValue.Contains(value) @stringValue LIKE N '% ' + @value + N '% '@stringValue LIKE N'%' + @value + N'%'
StringValue. EndsWith (Wert)stringValue.EndsWith(value) @stringValue LIKE N '% ' + @value@stringValue LIKE N'%' + @value
StringValue. FirstOrDefault ()stringValue.FirstOrDefault() Teil Zeichenfolge ( @stringValue , 1, 1)SUBSTRING(@stringValue, 1, 1) EF Core 5.0EF Core 5.0
StringValue. IndexOf (Wert)stringValue.IndexOf(value) CHARINDEX ( @value , @stringValue )-1CHARINDEX(@value, @stringValue) - 1
StringValue. LastOrDefault ()stringValue.LastOrDefault() Teil Zeichenfolge ( @stringValue , Len ( @stringValue ), 1)SUBSTRING(@stringValue, LEN(@stringValue), 1) EF Core 5.0EF Core 5.0
StringValue. lengthstringValue.Length LEN ( @stringValue )LEN(@stringValue)
StringValue. Replace ( @oldValue , @newValue )stringValue.Replace(@oldValue, @newValue) Replace ( @stringValue , @oldValue , @newValue )REPLACE(@stringValue, @oldValue, @newValue)
StringValue. starttwith (Wert)stringValue.StartsWith(value) @stringValue LIKE @value + N '% '@stringValue LIKE @value + N'%'
StringValue. Substring (startIndex, length)stringValue.Substring(startIndex, length) Teil Zeichenfolge ( @stringValue , @startIndex + 1, @length )SUBSTRING(@stringValue, @startIndex + 1, @length)
StringValue. ToLower ()stringValue.ToLower() Niedriger ( @stringValue )LOWER(@stringValue)
StringValue. ToUpper()stringValue.ToUpper() Upper ( @stringValue )UPPER(@stringValue)
StringValue. Trim ()stringValue.Trim() LTRIM (RTrim ( @stringValue ))LTRIM(RTRIM(@stringValue))
StringValue. temend ()stringValue.TrimEnd() RTRIM ( @stringValue )RTRIM(@stringValue)
StringValue. TrimStart ()stringValue.TrimStart() LTRIM ( @stringValue )LTRIM(@stringValue)

Sonstige FunktionenMiscellaneous functions

.NET.NET SQLSQL Hinzugefügt inAdded in
Ausstellung. Enthält (Element)collection.Contains(item) @item IN @collection@item IN @collection EF Core 3.0EF Core 3.0
EnumValue. hasflag (Flag)enumValue.HasFlag(flag) @enumValue & @flag = @flag@enumValue & @flag = @flag
Guid.NewGuid()Guid.NewGuid() NEWID()NEWID()
Werte zulässt. GetValueOrDefault ()nullable.GetValueOrDefault() COALESCE ( @nullable , 0)COALESCE(@nullable, 0)
Werte zulässt. GetValueOrDefault (DefaultValue)nullable.GetValueOrDefault(defaultValue) COALESCE ( @nullable , @defaultValue )COALESCE(@nullable, @defaultValue)

Hinweis

Einige SQL-Funktionen wurden zu Illustrations Zwecken vereinfacht.Some SQL has been simplified for illustration purposes. Die tatsächliche SQL-Verarbeitung ist komplexer, um eine größere Anzahl von Werten zu verarbeiten.The actual SQL is more complex to handle a wider range of values.

Weitere InformationenSee also