Skip to content

Add support for specifying column schema when adding mssql.NVarChar and mssql.VarChar #300

@vikas-rajvanshy

Description

@vikas-rajvanshy

Is your feature request related to a problem? Please describe.
For columns of type NVARCHAR(size) VARCHAR(size), the driver doesn't support efficient plan caching because parameters cannot be cast as the size in the column schema, rather they use the size of the parameter input. This causes plan re-use to fragment since different length strings result in different plans.

Describe the solution you'd like
Add support for passing the real column size as part of parameter something like NVarChar(var, 20) or VarChar(var, 1024) so that can be used to create a stable plan across input string sizes.

Describe alternatives you've considered
Looking at leveraging TVPs as a workaround.

Additional context
Ran into this when I was looking at query analyzer and see hundreds/thousands of plans for the same query

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