Just curious, what are your SQL pet peeves ?

  • Sean Lange (6/5/2014)


    SQLRNNR (6/5/2014)


    Sean Lange (6/5/2014)


    Luis Cazares (6/5/2014)


    Sean Lange (6/5/2014)


    SQLRNNR (6/5/2014)


    Luis Cazares (6/5/2014)


    TomThomson (6/5/2014)


    Luis Cazares (6/5/2014)


    Koen Verbeeck (6/5/2014)


    SQL is delicious (6/5/2014)


    ...also labors under the delusion that the American education system is worthless and that our master's level work is the equivalent of junior high/early high school material in India ...

    Yeah right. I got over 10,000 points at this forum mostly because of the highly educated people of said country.

    (I'm crudely generalizing here, but you get the point)

    That's not fair, you're not american 😀

    What! Are you telling us that only Americans are allowed to generalize crudely, Luis?

    I reject that utterly - we Gaels are allowed to do it too, and so areforeigners with names like "Koen".

    Yes, only Americans are allowed to generalize because Europeans have better education. And I'm counting myself as an American as part of the continent. :hehe:

    Yeah, Americans would be everybody in the Americas continents, right?

    North and South right?? 😛

    And Central?

    He was saying continents and you are on the same continent as I am. 😉

    Is he in North America as well? Two continents - North America and South America.

    http://www.whatarethe7continents.com/

    Umm yes. Last I checked Mexico was still on the North American continent. Also found there is the USA. 😎

    Yes Mexico is, but I was considering the true continents of North and South.:-D:-D

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • SQLRNNR (6/5/2014)


    Sean Lange (6/5/2014)


    SQLRNNR (6/5/2014)


    Sean Lange (6/5/2014)


    Luis Cazares (6/5/2014)


    Sean Lange (6/5/2014)


    SQLRNNR (6/5/2014)


    Luis Cazares (6/5/2014)


    TomThomson (6/5/2014)


    Luis Cazares (6/5/2014)


    Koen Verbeeck (6/5/2014)


    SQL is delicious (6/5/2014)


    ...also labors under the delusion that the American education system is worthless and that our master's level work is the equivalent of junior high/early high school material in India ...

    Yeah right. I got over 10,000 points at this forum mostly because of the highly educated people of said country.

    (I'm crudely generalizing here, but you get the point)

    That's not fair, you're not american 😀

    What! Are you telling us that only Americans are allowed to generalize crudely, Luis?

    I reject that utterly - we Gaels are allowed to do it too, and so areforeigners with names like "Koen".

    Yes, only Americans are allowed to generalize because Europeans have better education. And I'm counting myself as an American as part of the continent. :hehe:

    Yeah, Americans would be everybody in the Americas continents, right?

    North and South right?? 😛

    And Central?

    He was saying continents and you are on the same continent as I am. 😉

    Is he in North America as well? Two continents - North America and South America.

    http://www.whatarethe7continents.com/

    Umm yes. Last I checked Mexico was still on the North American continent. Also found there is the USA. 😎

    Yes Mexico is, but I was considering the true continents of North and South.:-D:-D

    I think we are both saying the same thing.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (6/5/2014)


    SQLRNNR (6/5/2014)


    Sean Lange (6/5/2014)


    SQLRNNR (6/5/2014)


    Sean Lange (6/5/2014)


    Luis Cazares (6/5/2014)


    Sean Lange (6/5/2014)


    SQLRNNR (6/5/2014)


    Luis Cazares (6/5/2014)


    TomThomson (6/5/2014)


    Luis Cazares (6/5/2014)


    Koen Verbeeck (6/5/2014)


    SQL is delicious (6/5/2014)


    ...also labors under the delusion that the American education system is worthless and that our master's level work is the equivalent of junior high/early high school material in India ...

    Yeah right. I got over 10,000 points at this forum mostly because of the highly educated people of said country.

    (I'm crudely generalizing here, but you get the point)

    That's not fair, you're not american 😀

    What! Are you telling us that only Americans are allowed to generalize crudely, Luis?

    I reject that utterly - we Gaels are allowed to do it too, and so areforeigners with names like "Koen".

    Yes, only Americans are allowed to generalize because Europeans have better education. And I'm counting myself as an American as part of the continent. :hehe:

    Yeah, Americans would be everybody in the Americas continents, right?

    North and South right?? 😛

    And Central?

    He was saying continents and you are on the same continent as I am. 😉

    Is he in North America as well? Two continents - North America and South America.

    http://www.whatarethe7continents.com/

    Umm yes. Last I checked Mexico was still on the North American continent. Also found there is the USA. 😎

    Yes Mexico is, but I was considering the true continents of North and South.:-D:-D

    I think we are both saying the same thing.

    I think we are both saying the same thing.

    *snigger*;-)

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • As most things, it depends.

    According to my education, America is a single continent divided in four regions: North, Central, South and Caribbean. According to the US education, North America and South America are 2 continents.

    Mexico is part of North America according to the usual concepts. But if you consider non political factors, it could be divided into North and Central America.

    To make everyone agree on whether there's one, two or three Americas is as difficult as making them to agree on the correct driving side of the road or to use decimal comma or decimal point.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (6/5/2014)


    As most things, it depends.

    According to my education, America is a single continent divided in four regions: North, Central, South and Caribbean. According to the US education, North America and South America are 2 continents.

    Mexico is part of North America according to the usual concepts. But if you consider non political factors, it could be divided into North and Central America.

    To make everyone agree on whether there's one, two or three Americas is as difficult as making them to agree on the correct driving side of the road or to use decimal comma or decimal point.

    You are saying by US education we learn that there are 2 continents and that by your education you learned there are 2 continents. Yes, the US people also consider the North American continent to have the same four regions.

    If we start bringing political considerations into it, Texas is part of Central America, Louisiana is in France and California is on Mars.

    Nobody mentioned political anything, it was continents and no matter what education system you come from there are 2 American continents.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Sean Lange (6/5/2014)


    Luis Cazares (6/5/2014)


    As most things, it depends.

    According to my education, America is a single continent divided in four regions: North, Central, South and Caribbean. According to the US education, North America and South America are 2 continents.

    Mexico is part of North America according to the usual concepts. But if you consider non political factors, it could be divided into North and Central America.

    To make everyone agree on whether there's one, two or three Americas is as difficult as making them to agree on the correct driving side of the road or to use decimal comma or decimal point.

    You are saying by US education we learn that there are 2 continents and that by your education you learned there are 2 continents. Yes, the US people also consider the North American continent to have the same four regions.

    If we start bringing political considerations into it, Texas is part of Central America, Louisiana is in France and California is on Mars.

    Nobody mentioned political anything, it was continents and no matter what education system you come from there are 2 American continents.

    I think that you missed my point. I learned that America is a single continent. But that might be wrong as I learned that Pluto was a planet.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (6/5/2014)


    Sean Lange (6/5/2014)


    Luis Cazares (6/5/2014)


    As most things, it depends.

    According to my education, America is a single continent divided in four regions: North, Central, South and Caribbean. According to the US education, North America and South America are 2 continents.

    Mexico is part of North America according to the usual concepts. But if you consider non political factors, it could be divided into North and Central America.

    To make everyone agree on whether there's one, two or three Americas is as difficult as making them to agree on the correct driving side of the road or to use decimal comma or decimal point.

    You are saying by US education we learn that there are 2 continents and that by your education you learned there are 2 continents. Yes, the US people also consider the North American continent to have the same four regions.

    If we start bringing political considerations into it, Texas is part of Central America, Louisiana is in France and California is on Mars.

    Nobody mentioned political anything, it was continents and no matter what education system you come from there are 2 American continents.

    I think that you missed my point. I learned that America is a single continent. But that might be wrong as I learned that Pluto was a planet.

    Wait a second...are you saying the Pluto isn't a planet??? LOL. OK I get what you are saying now. Boy this has been a conversation among the three of us with lots of confusion. :hehe:

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • But how would you alias those continents?:hehe::hehe:

    ***Just Kidding

    ***SQL born on date Spring 2013:-)

  • thomashohner (6/5/2014)


    But how would you alias those continents?:hehe::hehe:

    ***Just Kidding

    I could alias them and join them. 😀

    SELECT *

    FROM NorthAmerica na

    JOIN SouthAmerica sa ON na.PanamaSouthBorder = sa.ColombiaNorthBorder

    JOIN Europe eu ON na.NorthAtlanticOcean = eu.NorthAtlanticOcean

    JOIN Africa af ON sa.SouthAtlanticOcean = af.SouthAtlanticOcean

    JOIN Asia a ON na.BeringSea = a.BeringSea

    AND eu.Russia = a.Russia

    I don't use AS to alias tables but I like to use it to alias columns.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Luis Cazares (6/5/2014)


    thomashohner (6/5/2014)


    But how would you alias those continents?:hehe::hehe:

    ***Just Kidding

    I could alias them and join them. 😀

    SELECT *

    FROM NorthAmerica na

    JOIN SouthAmerica sa ON na.PanamaSouthBorder = sa.ColombiaNorthBorder

    JOIN Europe eu ON na.NorthAtlanticOcean = eu.NorthAtlanticOcean

    JOIN Africa af ON sa.SouthAtlanticOcean = af.SouthAtlanticOcean

    JOIN Asia a ON na.BeringSea = a.BeringSea

    AND eu.Russia = a.Russia

    I don't use AS to alias tables but I like to use it to alias columns.

    Now that's just awesome! 🙂

    ***SQL born on date Spring 2013:-)

  • Luis Cazares (6/5/2014)


    thomashohner (6/5/2014)


    But how would you alias those continents?:hehe::hehe:

    ***Just Kidding

    I could alias them and join them. 😀

    SELECT *

    FROM NorthAmerica na

    JOIN SouthAmerica sa ON na.PanamaSouthBorder = sa.ColombiaNorthBorder

    JOIN Europe eu ON na.NorthAtlanticOcean = eu.NorthAtlanticOcean

    JOIN Africa af ON sa.SouthAtlanticOcean = af.SouthAtlanticOcean

    JOIN Asia a ON na.BeringSea = a.BeringSea

    AND eu.Russia = a.Russia

    I don't use AS to alias tables but I like to use it to alias columns.

    Now that is some serious implicit type cast!

    😎

  • Sean Lange (6/5/2014)


    OK all this nonsense about how painful NOLOCK can be has prompted me to write this again. I know I have posted this on this site a few other times. I guess I need to start a blog on here and post it there. In the meantime let me share a real world story of NOLOCK and an arrogant DBA who refused to listen to pleas of a consultant (me). This was a company that processes credit card transactions.

    As you would imagine the database received a very high volume of traffic. The amount of traffic was increasing quickly and starting causing some blocking. This is obviously not a good thing when you have customers trying to swipe a plastic card and the system deadlocks or causes delays. Their senior DBA suddenly mandated that all queries must be implemented with NOLOCK, no exceptions. They went so far as to rebuild every single stored procedure in the system and include that hint on every single table. I caused a lot of commotion and complained that this was not a good decision and the company would in fact regret it at some point. Since I was just a consultant they listened to their DBA instead. Now you have to realize that I was also a consultant for the company that originally wrote the software that this new company purchased so I knew the system far better than any of them did.

    They spearheaded a project to add NOLOCK to every single table inside of every stored procedure (probably 2000+). This took considerable effort to code and test the entire system. It took somewhere around 3-4 months total time. The help desk stopped receiving calls about customers not being able to swipe their cards and everyone was happy. However, during the first month end auditing they started noticing that some accounts were being denied when they had funds and other accounts were approved when they didn't have funds. This generated lots of overdraft fees, which on a debit card can be around $25-50 per occurrence. This continued for next few months and the accountants were growing increasingly annoyed.

    They finally asked me to help them figure out why this kept happening. It took a couple weeks of data analysis and collection but I was finally able to prove that it was all because of dirty reads. We then started another project to undo all the NOLOCK hints in the same procedures we had just added them to. I can't even hazard a guess at how many thousands and thousands of dollars and man hours were wasted on this project. Once all that nonsense was corrected we discovered the source of the blocking and fixed the one procedure that was the issue.

    If they were looking for easy solutions, they should have tried setting the database to read committed snapshot. You eliminate locks for readers, and only have locks for inserts or updates, so you get the benefits of NOLOCK without inconsistent data and it eliminates most deadlocks.

    The only problem I have ever seen with read committed snapshot was with an application that kept transactions open for weeks at a time :crying:, causing the tempdb to fill up. Once I convinced the developer (one of the most arrogant sobs that I have ever worked with) that this was really happening and got him to fix it, the problem went away.

  • Luis Cazares (6/5/2014)


    Koen Verbeeck (6/5/2014)


    SQL is delicious (6/5/2014)


    ...also labors under the delusion that the American education system is worthless and that our master's level work is the equivalent of junior high/early high school material in India ...

    Yeah right. I got over 10,000 points at this forum mostly because of the highly educated people of said country.

    (I'm crudely generalizing here, but you get the point)

    That's not fair, you're not american 😀

    That's right, I have an even better eduction 😉

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • below86 (6/5/2014)


    How about doing data transformations in the ETL process. I know that's what the 'T' stands for. I can see changing date formats to work in SQL. But doing this on other fields can be a nightmare to figure out what is going on. I had an issue where the data was being changed by the ETL, lookup table, then there was SQL on the other side that also made changes to the same field. Of course I didn't know any transformation was being done on this field in the ETL. Why would I since we were doing other transformations in the SQL after it was loaded. But after hours of banging my head against the wall because I couldn't figure out how value 'XYZ' got into the field when it should be 'PDQ'. I finally found the code hidden in the field transformation. This drives my nuts. I prefer the ELT method instead of ETL, easier to debug, IMHO.

    And my critics say.....

    The critics say: it depends 🙂

    Some transformations are a no-brainer and should be done in SQL: sorting, grouping and aggregations being the most obvious examples.

    Other transformations can easily be done in the ETL, such as regex expressions for example.

    In your case: I blame the lack of proper documentation/comments.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Luis Cazares (6/5/2014)


    As most things, it depends.

    According to my education, America is a single continent divided in four regions: North, Central, South and Caribbean. According to the US education, North America and South America are 2 continents.

    Mexico is part of North America according to the usual concepts. But if you consider non political factors, it could be divided into North and Central America.

    To make everyone agree on whether there's one, two or three Americas is as difficult as making them to agree on the correct driving side of the road or to use decimal comma or decimal point.

    It is a pretty serious "it depends".

    Depending on how you define continents, you can have 4 up to 7 different continents.

    You could take Europe, Asia and Africe together in one giant continent (thanks to that small thingey in Egypt).

    Personally I have always learned there are 7 continents, Atlantis not counted. (unless Antarctica is actually Atlantis)

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

Viewing 15 posts - 121 through 135 (of 271 total)

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