Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parameter Sniffing Issue SQL Server [duplicate]

Tags:

c#

dbtype

I have taken over some C# code.

The code is hitting a database with some SQL which uses parameters.

All of the string parameters are typed as DbType.AnsiString instead of DbType.String.

Why would you use DbType.AnsiString instead of DbType.String?

like image 760
Craig Johnston Avatar asked Jun 16 '26 20:06

Craig Johnston


1 Answers

AnsiString
A variable-length stream of non-Unicode characters ranging between 1 and 8,000 characters.

String
A type representing Unicode character strings.

In database:

nchar and nvarchar is unicode

char and varchar is non-unicode

like image 142
edze Avatar answered Jun 19 '26 11:06

edze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!