SqlServer SMO StoredProcedureParameter Bug?
I'm creating a Windows Forms application which auto-generates my stored procedures for me.
Based upon a column's DataType property I'm creating instances of StoredProcedureParameter as below:
if
(column.InPrimaryKey){StringBuilder parameterBuilder =newStringBuilder("@");
parameterBuilder.Append(column.Name);
sp.Parameters.Add(newStoredProcedureParameter(sp, parameterBuilder.ToString(), column.DataType));
Unfortunately when the columns datatype is nvarchar(max) the stored procedure is created with the following erronous parameter declaration
@SettingValue [nvarchar](100),@SettingDescription [nvarchar]
,@SettingCategory [nvarchar]
(50),Notice how the SettingValue and SettingCategory parameters correctly specify the size as 100 and 50 respectfully. SettingDescription is defined in the table design as an nvarchar(max). However SMO creates it as a single character nvarchar.
Thanks in advance
Doug Holland

