Skip to content

Data type for SQL Server for DbType.String #10

@beppler

Description

@beppler

On DbTypes x SqlServer is documented that the types generated for DbType.String are the following:

  • nvarchar(255) if precision is not specified
  • nvarchar(n) if precision is between 1 and 8000
  • text if precision greater than 8000

Based on SQL Server Data Type Mappings the type used for String should be:

  • nvarchar(255) if precision is not specified (to remain compatible with previous behavior)
  • nvarchar(n) for precision between 1 and 4000
  • nvarchar(max) for precision bigger than 4000

The mediumtext datatype does not exist on SQL Server and ntext datatype is deprecated, but should be used if SQL Server is version 2005 or older.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions