Fields Concatenation in SQL Query

  • Would Fields Concatenation in the Select Statement of SQL affect the query performance?

    Eg:

    SELECT FirstName, LastName FROM NamesTable

    Vs

    SELECT LastName + '-' + FirstName FROM NamesTable

    Rply,

    ASHOK S

     

  • What did you find when you tested it to see what happens?

     

     

  • It's a part of a complex query.

    It sometimes results in 2-3 seconds and sometimes more than 20 seconds.

    will that be one of the possibilities of delaying the result?

    Thanks

     

  • Try to test just these two statements you posted, on a large table, if there is any difference. My guess is that the difference will be minimal and not worth considering in a complex query, as long as the concatenated name is just output - not part of some condition. But that's just a guess and the best way to find out is to try it 

Viewing 4 posts - 1 through 3 (of 3 total)

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