Which is better while using Stored Procedures? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Which is better while using Stored Procedures?

Hi,
In my ASP.Net project, i am using sqlserver200. While using stored procedures passing the parametes we have two ways like
objParam1 = MyCmd.Parameters.Add("@FirstName", SqlDbType.VarChar)
(Here i didn’t pass length of that parameter) and the other way is:
objParam1 = MyCmd.Parameters.Add("@FirstName", SqlDbType.VarChar, 50)
(Here i am passing length) Both are working fine. I want to know which one is better, which one is performed better? Hope you understand, Thanks in Advance, Lalitha.C

I think if you dont specify the width the parameter will have its width as the length of @FirstName
It will work even if its length is more than 50. Second case wont work if length is more than 50
But in practise it is better to specify the width
So use second mehtod
Madhivanan Failing to plan is Planning to fail
]]>