|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
nvarchar(max) and corresponding SqlDbTypeHi All,
I am using nvarchar(max) as a parameter for a stored procedure in a SQL Server 2005 database. What is the corresponding SqlDbType in this case? System.Data.SqlDbType.NVarChar is limited to 4,000 characters. MSDN says, "Explicitly set the object when working with strings longer than 4,000 characters." I am not sure what this means. Thank you for your help. Dmitriy.
Show quote
"Dmitriy Melikov" <DmitriyMeli***@discussions.microsoft.com> wrote in I think it means that you can just access the parameter value directly, message news:4D55D6C5-50B5-43F8-9C4D-0CFBB4376032@microsoft.com... > Hi All, > > I am using nvarchar(max) as a parameter for a stored procedure in a SQL > Server 2005 database. > What is the corresponding SqlDbType in this case? > > System.Data.SqlDbType.NVarChar is limited to 4,000 characters. > MSDN says, "Explicitly set the object when working with strings longer > than > 4,000 characters." > > I am not sure what this means. > either setting or getting a System.String. See, the example under "Using Large Value Type Parameters" Working with Large Value Types http://msdn2.microsoft.com/en-us/library/a1904w6t.aspx David Thank you, David.
It is very helpful. Another way to solve this problem is to use Microsoft.SqlServer.Management.Smo.SqlDataType.NVarCharMax as a SQL data type to create a SqlParameter. Dmitriy. Show quote "David Browne" wrote: > > > "Dmitriy Melikov" <DmitriyMeli***@discussions.microsoft.com> wrote in > message news:4D55D6C5-50B5-43F8-9C4D-0CFBB4376032@microsoft.com... > > Hi All, > > > > I am using nvarchar(max) as a parameter for a stored procedure in a SQL > > Server 2005 database. > > What is the corresponding SqlDbType in this case? > > > > System.Data.SqlDbType.NVarChar is limited to 4,000 characters. > > MSDN says, "Explicitly set the object when working with strings longer > > than > > 4,000 characters." > > > > I am not sure what this means. > > > > I think it means that you can just access the parameter value directly, > either setting or getting a System.String. See, the example under "Using > Large Value Type Parameters" > > > > Working with Large Value Types > http://msdn2.microsoft.com/en-us/library/a1904w6t.aspx > > David > > |
|||||||||||||||||||||||