RSS

Category Archives: SQL Code

SQL Saturday – An Event To Repeat

For those of you not in the know, you should be on the look-out for a SQL Saturday event in your area. They are free events, with a small fee for lunch, that tend to help you learn a lot about SQL. The training is all volunteer led and usually a lot of fun.

I attend SQL Saturday #85 this past weekend and had a good time. Five of my co-workers went with me and we all learned some new things we should be able to use in the workplace almost immediately.

One of the best classes I sat in was “Revenge The SQL!”. This class taught us a bunch of nefarious ways you can really mess with developers and anyone else trying to look at your database. More than anything, the class showed us some ways just to have some fun… Did you know it is possible to have upwards of 5000 tables in your database, all with the exact same name of nothing. That is not the name of nothing, but no name at all…blank…empty…etc.

And I am not going to give away what I learned…if you want the same knowledge I got, plan to attend a SQL saturday near you and get involved in the SQL movement! LOL.

Advertisements
 
1 Comment

Posted by on September 26, 2011 in SQL Code

 

Great T-SQL Trick: Month And Year From Date

Well, over at one of my favorite forums, Tek-Tips, I was watching a particular thread related to getting the month and year from a particular date. You have to read the whole thing, as the original poster’s issue was quite easy with a bit more SQL background, but the answer supplied by gmmastros – who is pretty much the closest thing to a SQL god I know – was something I would never have thought of. His answer was:

Select Month(GetDate()) * 100 + Year(GetDate()) % 100

Make sure you head on over to the specific thread to read the whole thing.

 
Leave a comment

Posted by on August 4, 2011 in SQL Code