Mapping Data Types and Functions
- Last Updated: April 16, 2026
- 6 minute read
- ADO.NET
- Documentation
Mapping Sybase Data Types to Simple Types
In the following table, the columns are defined as follows:
- The Sybase Data Type column refers to the native type name.
- The SSDL column refers to data types used by the store schema definition language (SSDL) file. The storage metadata schema is a formal description of the database that persists data for an application built on the EDM.
- The EDM Simple Type column refers to the method that must be used to access a column of this type when using a DataReader.
Mapping Sybase Data Types to EDM Simple Types
| Sybase Data Type | SSDL Data Type | EDM Simple Type |
| BigInt | bigint | Int64 |
| Binary | binary | Binary |
| Bit | Bit | Boolean |
| Byte | byte | Byte |
| Char | char | String |
| Date | date | Date |
| Datetime | datetime | Datetime |
| Decimal | decimal | Decimal |
| Float | float | Double |
| Image | image | Binary |
| Int | int | Int32 |
| Money | money | Decimal |
| Numeric | numeric | Decimal |
| Nvarchar | ||
| Real | real | Single |
| SmallDateTime | smalldatetime | Datetime |
| SmallInt | smallint | Int16 |
| Smallmoney | smallmoney | Decimal |
| Sysname | sysname | String |
| Text | text | String |
| Time | time | Time |
| Tinyint | Tinyint | Byte |
| Unichar | unichar | String |
| Unitext | unitext | String |
| Univarchar | univarchar | String |
| Varbinary | varbinary | Binary |
| VarChar | Varchar | String |
| UnsignedInt | Unsignedint | String |
| UnsignedSmallInt | unsignedsmallint | String |
The following table shows the mapping of EDM Simple Types to Sybase data types. The columns are defined as follows:
- The EDM Simple Type column refers the method that must be used to access a column of this type when using a DataReader.
- The SSDL column refers to data types used by the store schema definition language (SSDL) file. The storage metadata schema is a formal description of the database that persists data for an application built on the EDM.
- The Sybase Data Type column refers to the native type name.
Mapping EDM Simple Types to Sybase Data Types
| EDM Simple Type | SSDL Data Type | Sybase Data Type |
| Binary | binary | Binary |
| Binary | image | Image |
| Binary | varbinary | Varbinary |
| Boolean | Bit | Bit |
| Byte | byte | Byte |
| Byte | Tinyint | Tinyint |
| Date | date | Date |
| Datetime | datetime | Datetime |
| Datetime | smalldatetime | SmallDateTime |
| DateTimeOffSet | datetime_as_datetimeoffset | Datetime |
| Decimal | decimal | Decimal |
| Decimal | money | Money |
| Decimal | numeric | Numeric |
| Decimal | smallmoney | Smallmoney |
| Double | float | Float |
| Int16 | smallint | SmallInt |
| Int32 | int | Int |
| Int64 | bigint | BigInt |
| Single | real | Real |
| String | char | Char |
| String | sysname | Sysname |
| String | text | Text |
| String | unichar | Unichar |
| String | unitext | Unitext |
| String | univarchar | Univarchar |
| String | Varchar | VarChar |
| String | Unsignedint | UnsignedInt |
| String | unsignedsmallint | UnsignedSmallInt |
| Time | time | Time |
Mapping EDM Canonical Functions to Sybase Functions
The ADO.NET Entity Framework translates the Entity Data Model (EDM) canonical functions to the corresponding data source functionality for the ADO.NET Sybase Entity data provider. The function invocations are expressed in a common form across data sources.
Because these canonical functions are independent of data sources, argument and return types of canonical functions are defined in terms of types in the EDM. When an Entity SQL query uses canonical functions, the appropriate function is called at the data source.
Both null-input behavior and error conditions are explicitly specified for all canonical functions. However, the ADO.NET Entity Framework does not enforce this behavior. Further details are available at:
https://msdn.microsoft.com/en-us/library/bb738626.aspx
Aggregate Canonical Functions
The following table describes the mapping of EDM aggregate canonical functions to Sybase functions.
Mapping Aggregate Canonical Functions
| Aggregate Canonical Function | Sybase functions |
| Avg(expression) | AVG(expression) |
| BigCount(expression) | COUNT_BIG(expression) |
| Count(expression) | COUNT(expression) |
| Max(expression) | MAX(expression) |
| Min(expression) | MIN(expression) |
| StDev(expression) | STDEV_SAMP(expression) |
| StDevP(expression) | StDev_POP(expression) |
| Sum(expression) | SUM(expression) |
Math Canonical Functions
The following table describes the mapping of EDM math canonical functions to Sybase functions.
Mapping Math Canonical Functions
| Math Canonical Function | Sybase Function |
| Abs(value) | ABS(value) |
| Ceiling(value) | CEILING(value) |
| Floor(value) | FLOOR(value) |
| Power(value, exponent) | Power(value, exponent) |
| Round(value) | ROUND(value, 0) |
| Round(value, digits) | ROUND(value, 0) |
| Truncate(value, digits) | Truncate(value, digits) |
Date and Time Canonical Functions
The following table describes the mapping of EDM date and time canonical functions to Sybase functions.
Mapping Date and Time Canonical Functions
| Date and Time Canonical Function | Sybase Functions |
| AddNanoseconds( expression, number) | DATEADD(miliisecond,(interval/1000000),CAST(dateExpression AS DATETIME)) |
| AddMicroseconds( expression, number) | DATEADD(millisecond,(interval/1000),CAST(dateExpression AS DATETIME)) |
| AddMilliseconds( expression, number) | DATEADD(millisecond,interval,CAST(dateExpression AS DATETIME)) |
| AddSeconds( expression, number) | DATEADD(seconds,interval,CAST(dateExpression AS DATETIME)) |
| AddMinutes( expression, number) | DATEADD(minute,interval,CAST(dateExpression AS DATETIME)) |
| AddHours( expression, number) | DATEADD(hour,interval,CAST(dateExpression AS DATETIME)) |
| AddDays( expression, number) | DATEADD(day,interval,CAST(dateExpression AS DATETIME)) |
| AddMonths( expression, number) | DATEADD(month,interval,CAST(dateExpression AS DATETIME)) |
| AddYears( expression, number) | DATEADD(year,interval,CAST(dateExpression AS DATETIME)) |
| CreateDateTime( year, month, day, hour, minute, second) | CAST( CAST(expr1 AS VARCHAR) || '-' || CAST(expr2 AS VARCHAR) || '-' || CAST(expr3 AS VARCHAR) || ' ' || CAST(expr4 AS VARCHAR) || ':' || CAST(expr5 AS VARCHAR) || ':' || CAST(expr6 AS VARCHAR) AS DATETIME ) |
| CreateTime( hour, minute, second) | CAST( CONVERT( VARCHAR, DATEPART(hh,CAST ("expr1:expr2:expr3" AS TIME))) || ':' || CONVERT( VARCHAR, DATEPART(mi,CAST ("expr1:expr2:expr3" AS TIME))) || ':' || CONVERT( VARCHAR, DATEPART(ss,CAST ("expr1:expr3:expr3" AS TIME))) AS TIME ) |
| CurrentDateTime() | GETDATE() |
| CurrentDateTimeOffset() | ( CONVERT(VARCHAR, DATEPART(YEAR, GETDATE())) || '-' || LTRIM(CASE WHEN DATEPART(MONTH, GETDATE()) < 10 THEN '0' ELSE '' END) || CONVERT(VARCHAR, DATEPART(MONTH, GETDATE())) || '-' || LTRIM(CASE ELSE '' END) || CONVERT(VARCHAR, DATEPART(DAY, GETDATE())) || LTRIM(CASE WHEN DATEPART(HOUR, GETDATE()) < 10 THEN '0' ELSE '' END) || CONVERT(VARCHAR, DATEPART(HOUR, GETDATE())) || ':' || LTRIM(CASE WHEN DATEPART(MINUTE, GETDATE()) < 10 THEN '0' ELSE '' END) || CONVERT(VARCHAR, DATEPART(MINUTE, GETDATE())) || ':' || LTRIM(CASE WHEN DATEPART(SECOND, GETDATE()) < 10 THEN '0' ELSE '' END) || |
| ...contd... | CONVERT(VARCHAR, DATEPART(SECOND, GETDATE())) || '.' || LTRIM(CASE WHEN DATEPART(MILLISECOND, GETDATE()) < 10 THEN '00' WHEN DATEPART(MILLISECOND, GETDATE()) < 100 THEN '0' ELSE '' END) || CONVERT(VARCHAR, DATEPART(MILLISECOND, GETDATE())) || ' ' || LTRIM(CASE WHEN DATEDIFF(HOUR, GETUTCDATE(), GETDATE()) < 0 THEN '-' ELSE '' END) || LTRIM(CASE WHEN ABS(DATEDIFF(HOUR, GETUTCDATE(), GETDATE())) < 10 THEN '0' ELSE '' END) || CONVERT(VARCHAR, ABS(DATEDIFF(HOUR, GETUTCDATE(), GETDATE()))) || ':' || LTRIM(CASE WHEN DATEDIFF(MINUTE, GETUTCDATE(), GETDATE()) - (DATEDIFF(HOUR, GETUTCDATE(), GETDATE()) * 60) < 10 THEN '0' ELSE '' END) || CONVERT(VARCHAR, DATEDIFF(MINUTE, GETUTCDATE(), GETDATE()) - (DATEDIFF(HOUR, GETUTCDATE(), GETDATE()) * 60)) ) |
| CurrentUtcDateTime | GETUTCDATE() |
| Day(expression) | DAY(expression) |
| DayOfYear( expression ) | datepart(dy, CAST(datetime_expr AS VARCHAR)) |
| DiffNanoseconds( startExpression, endExpression) | DATEDIFF(millisecond,CASTstartExpression AS DATETIME),CAST(endExpression AS DATETIME))*1000000 |
| DiffMilliseconds( startExpression, endExpression) | DATEDIFF(millisecond,CASTstartExpression AS DATETIME),CAST(endExpression AS DATETIME)) |
| DiffMicroseconds( startExpression, endExpression) | DATEDIFF(millisecond,CASTstartExpression AS DATETIME),CAST(endExpression AS DATETIME))*1000 |
| DiffSeconds( startExpression, endExpression) | DATEDIFF(second,CASTstartExpression AS DATETIME),CAST(endExpression AS DATETIME)) |
| DiffMinutes( startExpression, endExpression) | DATEDIFF(minute,CASTstartExpression AS DATETIME),CAST(endExpression AS DATETIME)) |
| DiffHours( startExpression, endExpression) | DATEDIFF(hour,CASTstartExpression AS DATETIME),CAST(endExpression AS DATETIME)) |
| DiffDays( startExpression, endExpression) | DATEDIFF(day,CASTstartExpression AS DATETIME),CAST(endExpression AS DATETIME)) |
| DiffMonths( startExpression, endExpression) | DATEDIFF(month,CASTstartExpression AS DATETIME),CAST(endExpression AS DATETIME)) |
| DiffYears( startExpression, endExpression) | DATEDIFF(year,CASTstartExpression AS DATETIME),CAST(endExpression AS DATETIME)) |
| GetTotalOffsetMinutes(DateTimeOffset) | CONVERT(INT, SUBSTRING( CAST( expr1 AS VARCHAR ) ,CHAR_LENGTH( CAST(expr1 AS VARCHAR) ) -5 , 1 ) ) + CONVERT(INT, SUBSTRING( CAST( expr1 AS VARCHAR ) ,CHAR_LENGTH( CAST(expr1 AS VARCHAR) ) - 1 , 2 ) ) + CONVERT(INT, SUBSTRING( CAST( expr1 AS VARCHAR ) , CHAR_LENGTH( CAST(expr1 AS VARCHAR) ) -4 , 2 ) )*60 |
| Hour(expression) | DATEPART(HOUR, expression) |
| Millisecond(expression) | DATEPART(MILLISECOND, expression) |
| Minute(expression) | DATEPART(MINUTE, expression) |
| Month(expression) | DATEPART(Month, expression) |
| Second(expression) | DATEPART(SECOND, expression) |
| TruncateTime( expression ) | cast(convert(varchar, CAST("datetime_expr" AS VARCHAR) , 1) as datetime) |
| Year(expression) | DATEPART(Second, expression) |
Bitwise Canonical Functions
The following table describes the mapping of EDM bitwise canonical functions to Sybase functions.
Mapping Bitwise Canonical Functions
| Bitwise Canonical Function | Sybase Functions |
| BitWiseAnd (value1, value2) | (value1 & value2) |
| BitWiseNot (value) | (~value) |
| BitWiseOr (value1, value2) | (value1 | value2) |
| BitWiseXor (value1, value2) | (value1 ^ value2) |
| NewGuid () | NEWID() |
String Canonical Functions
The following table describes the mapping of EDM string canonical functions to Sybase functions.
Mapping String Canonical Functions
| String Canonical Function | Sybase Function |
| Concat(string1, string2) | (string1 || string2) |
| Contains (string, target) | Contains (string, target) |
| EndsWith (string, target) | EndsWith (string, target) |
| IndexOf(target, string) | CHARINDEX(target, string) |
| Left(string, length) | LEFT(string) |
| Length(string) | LEN(string) |
| LTrim(string) | LTRIM(string) |
| Replace(string1, string2, string3) | STR_REPLACE(string1, string2, string3) |
| Reverse(string) | REVERSE(string) |
| Right(string, length) | RIGHT(string, length) |
| RTrim(string) | RTRIM(string) |
| StartsWith(string, target) | CharIndex(string, target) |
| Substring(string, start, length) | SUBSTRING(string, start, length) |
| ToLower(string) | LOWER(string) |
| ToUpper(string) | UPPER(string) |
| Trim(string) | LTRIM(RTRIM(string)) |
Other Canonical Functions
The following table describes the mapping of EDM other canonical functions to Sybase functions.
Mapping Other Canonical Functions
| Other Canonical Function | Sybase Functions |
| NewGuid() | NewGuid() |
Handling Unsupported Canonical Functions
Because some canonical functions are not supported on the underlying database, the Entity Framework data provider allows the function call to "fall through" to the database. In other words, the Entity Framework data provider simply passes the function call to the database server as is. For example, Sybase does not support features that rely on DateTimeOffset. To provide that functionality, you can create a custom function of the same name on the database that the data provider can call.