How to create NVarchar(max) Sqlparameter in C#? [duplicate]
This question already has an answer here: What size do you use for varchar(MAX) in your parameter declaration? 4 answers I've got the following code to pull back a DataTable using a stored procedure and inputting a string parameter @JobNumbers, which is dynamically created string of job numbers (and therefore length is unknown): using (SqlConnection connection = new SqlConnection(con)) { SqlCommand cmd = new SqlCommand("dbo.Mystoredprocedure", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@JobNumbers", SqlDbType.VarChar, 4000); cmd.Parameters["@JobNumbers"]