Any performance improvement

  • Hi

    is there any performance improvment in sql 2008 while providing comma(,) at the left side of the column instead of right side..just curious to know :-D...in sql2008 i have seen lot of example using this

    INSERT INTO tablename

    (

    column1

    ,column2

    ,column3

    ,column4

    )

    VALUES

    (

    columnvalue1

    ,columnvalue2

    ,columnvalue3

    ,columnvalue4

    )

  • Hi there,

    Putting comma on left or right side has no impact on performance.. 🙂 The syntax is just the same..

    I think people put it on the left side so they can easily comment the line if a column has been dropped like this:

    INSERT INTO tablename

    (

    column1

    ,column2

    ,column3

    --,column4

    )

    VALUES

    (

    columnvalue1

    ,columnvalue2

    ,columnvalue3

    --,columnvalue4

    )

    You can also use this format in SELECT..

    I hope this helps.. 🙂

  • thanks

  • Welcome.. It's a pleasure to help..

  • Just curious why you thought it might matter? Would it matter if the opening paren was on the same line as the column or on a different line? Just wondering what drove the question.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • a

  • ramboabc (9/2/2010)


    a

    b

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • shield_21 (9/1/2010)


    Hi there,

    Putting comma on left or right side has no impact on performance.. 🙂 The syntax is just the same..

    I think people put it on the left side so they can easily comment the line if a column has been dropped like this:

    INSERT INTO tablename

    (

    column1

    ,column2

    ,column3

    --,column4

    )

    VALUES

    (

    columnvalue1

    ,columnvalue2

    ,columnvalue3

    --,columnvalue4

    )

    You can also use this format in SELECT..

    I hope this helps.. 🙂

    I don't think it makes it any easier/harder to comment out lines at all. If you put commas after the column name, you can comment all columns out except the last without a syntax problem and it you put it before, you can comment all but the first.

    Some people say it improves readability/formatting - it's certainly easier to spot if one's missing...

  • It is a matter of taste but usually people are not expecting to find a comma at the beginning of the line in a normal text, so putting the comma at the end could be a slight improvement for reading the code.

    brgds

    Philipp Post

    brgds

    Philipp Post

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply