• theashishtrivedi (4/2/2013)


    Thanks for reply.

    I agree with your explanation and I do follow as you said. Can you tell me if there is any performance gain, if I maintain the length of VARCHAR as per requirement. I want to convince my manager that VARCHAR(2000) is really not required everywhere.

    As has been said already , no difference if it's VARCHAR(200) VARCHAR(2000) or VARCHAR(6000). A single character will occupy a single byte.

    DECLARE @test1 VARCHAR(200)

    DECLARE @Test2 VARCHAR(2000)

    DECLARE @Test3 VARCHAR(8000)

    SET @test1 = 'ABC'

    SET @Test2 = 'ABC'

    SET @Test3 = 'ABC'

    select DATALENGTH(@test1), DATALENGTH(@test2), DATALENGTH(@test3)

    200, 2000 or 8000 won't hurt your performance but queries that request more data than they need will.

    ---------------------------------------------------------

    It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
    David Edwards - Media lens[/url]

    Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
    Howard Zinn