Table Alias

  • Vinay Kumar

    SSCertifiable

    Points: 6098

    Comments posted to this topic are about the item Table Alias

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

  • Ron McCullough

    SSC Guru

    Points: 63877

    Nice question on the basics ... thanks

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • malleswarareddy_m

    SSCertifiable

    Points: 5847

    Easy Question

    Malleswarareddy
    I.T.Analyst
    MCITP(70-451)

  • vinu512

    SSCoach

    Points: 15729

    A very easy on Danny....but nothing better than going back to basics 🙂

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • vinu512

    SSCoach

    Points: 15729

    A very easy one Danny....but nothing better than going back to basics 🙂

    Edit: Sorry for the double post....the browser hung up on me. :hehe:

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • kapil_kk

    SSC-Insane

    Points: 21316

    Good basic question Vinay 🙂

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

  • Raghavendra Mudugal

    SSChampion

    Points: 10658

    YES; finally my powers are restored in my finnnngers (i mean i selected the right answer :-P)

    thank you for the post, nothing can beat the classics;

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Carlo Romagnano

    SSC-Insane

    Points: 21965

    I like explanation!

    😀

  • Hugo Kornelis

    SSC Guru

    Points: 64685

    Good question, though I'm surprised that, apparently, people are doing this wrong. Since you'll be rewarded by an error message when you try, I don't understand how people could not do this correct - at least after being hit once.

    However, to do some nitpicking:

    1. If I were to try this code on my system, I would get five errors. All system table (*) names are completely lowercase, so everyone who has a server set up with a case sensitive collation will get error messages. (And I think every development server SHOULD be set up with case sensitive collation - developing there and deploying to a case insensitive server is okay, the other word around is a disaster)

    2. I don't see the advantage of using a system table (*) in this question. Why not add a CREATE TABLE to make a simple demo table and use that? Okay, it would have been a bit more code in the question, but it would save all the readers of having to look up if the various columns used in the question actaully exist in sysobjects.

    3. And if you must use a system table (*), at least avoid using the deprecated ones. You could have used sys.objects instead. Please don't encourage people to use compatibility views; they might just be gone in the next release!

    (*) Yeah, I know, I know. Not system tables, but system views. Or rather: compatibility view (for sysobjects) and object catalog view (for sys.objects)


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Hugo Kornelis

    SSC Guru

    Points: 64685

    EDIT: Double post removed.

    (I got an error message when posting, so I assumed the post didn't go through. Should have checked before reposting)


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Vinay Kumar

    SSCertifiable

    Points: 6098

    Hugo Kornelis (5/2/2013)


    Good question, though I'm surprised that, apparently, people are doing this wrong. Since you'll be rewarded by an error message when you try, I don't understand how people could not do this correct - at least after being hit once.

    Hugo, that's the reason i have post the Question.

    And thanks for your suggestions, i will keep them in mind for future questions. 🙂

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

  • WWDMark

    Hall of Fame

    Points: 3157

    Nice easy one (even for me!). Thanks.


    MCITP
    MCTS - E-Business Card
    Twitter: WWDMark

    Try not! Do or do not, there is no try

    email: info@weekendwebdesign.co.uk
    Personal Website: http://markallen.co.uk/
    Business Website: https://www.weekendwebdesign.co.uk

  • kapil_kk

    SSC-Insane

    Points: 21316

    Hugo Kornelis (5/2/2013)


    Good question, though I'm surprised that, apparently, people are doing this wrong. Since you'll be rewarded by an error message when you try, I don't understand how people could not do this correct - at least after being hit once.

    However, to do some nitpicking:

    1. If I were to try this code on my system, I would get five errors. All system table (*) names are completely lowercase, so everyone who has a server set up with a case sensitive collation will get error messages. (And I think every development server SHOULD be set up with case sensitive collation - developing there and deploying to a case insensitive server is okay, the other word around is a disaster)

    2. I don't see the advantage of using a system table (*) in this question. Why not add a CREATE TABLE to make a simple demo table and use that? Okay, it would have been a bit more code in the question, but it would save all the readers of having to look up if the various columns used in the question actaully exist in sysobjects.

    3. And if you must use a system table (*), at least avoid using the deprecated ones. You could have used sys.objects instead. Please don't encourage people to use compatibility views; they might just be gone in the next release!

    (*) Yeah, I know, I know. Not system tables, but system views. Or rather: compatibility view (for sysobjects) and object catalog view (for sys.objects)

    +1 🙂

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

  • Divine Flame

    SSCoach

    Points: 15941

    Thanks for the question.


    Sujeet Singh

  • Lokesh Vij

    SSChampion

    Points: 10836

    Thanks for the question Vinay.

    An easy one for the day. It's always good to refresh our basics 🙂

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

Viewing 15 posts - 1 through 15 (of 33 total)

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