SELECT (Transact-SQL)

  • Danny Ocean

    SSCertifiable

    Points: 6098

    kapil_kk (10/25/2012)


    One question, I am confused on this...

    select ID, name name from person

    select ID ID, name name from person

    Both these statements dont give any error message and run successfully...

    wht is it so?

    Hi kapil,

    1st statement :-

    it's showing that you are giving the alias column name to column 2(name). I can also right this like:-

    select ID, name as [name] from person

    or

    select ID, name as [Column_2] from person

    2nd Statement :-same thing happen in 2nd statement.

    Check below statement. have fun

    select '--------------------' as TT

    select 233 as '____________'

    Thanks

    Vinay

    Thanks
    Vinay Kumar
    -----------------------------------------------------------------
    Keep Learning - Keep Growing !!!

  • asifkareem

    Ten Centuries

    Points: 1089

    Good Exercise for Basic of SQL.

    Nice One

    Thanks:-)

  • @Cassie

    SSC Eights!

    Points: 887

    Easy question.

    It shows once again, the more options/possibilities, the more errors can be made.

  • kapil_kk

    SSC-Insane

    Points: 21316

    Thanks Danny 🙂

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

Viewing 4 posts - 31 through 34 (of 34 total)

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