Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««1234»»»

Table Alias Expand / Collapse
Author
Message
Posted Thursday, May 2, 2013 1:33 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, February 6, 2014 4:15 AM
Points: 1,242, Visits: 1,546
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 !!!
www.GrowWithSql.com

Post #1448715
Posted Thursday, May 2, 2013 1:50 AM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Monday, September 1, 2014 7:39 AM
Points: 642, Visits: 520
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: www.markallen-online.co.uk
Business Website: www.weekendwebdesign.co.uk
Post #1448718
Posted Thursday, May 2, 2013 2:54 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 2:33 AM
Points: 1,944, Visits: 2,385
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/
Post #1448732
Posted Thursday, May 2, 2013 3:37 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 7:56 AM
Points: 1,329, Visits: 2,620
Thanks for the question.


Sujeet Singh
Post #1448737
Posted Thursday, May 2, 2013 5:46 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, October 16, 2014 10:02 AM
Points: 1,372, Visits: 1,566
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
Guidelines for answers on Performance questions

Link to my Blog Post --> www.SQLPathy.com

Follow me @Twitter

Post #1448772
Posted Thursday, May 2, 2013 5:57 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 3:07 AM
Points: 3,093, Visits: 984
Hugo Kornelis (5/2/2013)

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)

Not necessarily true. If your development server is case sensitive you run the risk of having more than one object with the same name, only with different casing. When deploying on a case INsensitive server it will blow up.



Just because you're right doesn't mean everybody else is wrong.
Post #1448773
Posted Thursday, May 2, 2013 6:12 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Wednesday, November 19, 2014 3:56 PM
Points: 6,086, Visits: 8,354
Rune Bivrin (5/2/2013)
Hugo Kornelis (5/2/2013)

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)

Not necessarily true. If your development server is case sensitive you run the risk of having more than one object with the same name, only with different casing. When deploying on a case INsensitive server it will blow up.

Technically true. Realistically, the chance of this happening by accident is a lot smaller than the chance of using wrong case on a case insensitive server.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1448775
Posted Thursday, May 2, 2013 6:17 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 1:19 AM
Points: 2,592, Visits: 2,446
Rune Bivrin (5/2/2013)
Hugo Kornelis (5/2/2013)

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)

Not necessarily true. If your development server is case sensitive you run the risk of having more than one object with the same name, only with different casing. When deploying on a case INsensitive server it will blow up.

+1
Why should you choose CASE SENSITIVE COLLATION?
Please, do not answer for performance reason!
Post #1448777
Posted Thursday, May 2, 2013 7:15 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, August 13, 2013 11:43 AM
Points: 242, Visits: 433
Hugo Kornelis (5/2/2013)
Rune Bivrin (5/2/2013)
Not necessarily true. If your development server is case sensitive you run the risk of having more than one object with the same name, only with different casing. When deploying on a case INsensitive server it will blow up.

Technically true. Realistically, the chance of this happening by accident is a lot smaller than the chance of using wrong case on a case insensitive server.

It seems more likely to me than the chance of having code deployed to a case sensitive server without having been previously informed that case sensitivity was a business requirement. Case sensitive strikes me as an annoyingly persnickity environment to code in though, so I may be biased.



Puto me cogitare, ergo puto me esse.
I think that I think, therefore I think that I am.
Post #1448803
Posted Thursday, May 2, 2013 7:59 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, November 20, 2014 11:12 AM
Points: 165, Visits: 489
Thanks for the question, some people tend to forget the basics and waste time chasing their tales. Whether you use system tables, depricated or user tables you proved your point.



Post #1448825
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse