SQL Server Performance

Which is better while using Stored Procedures?

Discussion in 'T-SQL Performance Tuning for Developers' started by lalitha_karani, Aug 19, 2005.

  1. lalitha_karani New Member

    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,

  2. Madhivanan Moderator

    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


    Failing to plan is Planning to fail

Share This Page