Posts

Calculating Days of the Week and Accounting Months 5-4-4

Ever needed a quick Date formula? In my world I do not need such funky date formulas all the time, only during the occasional Report week of the year. With that said though, I know others run into this need frequently. I found this while perusing one of my favorite sites, enjoy as there is very good detail and sample code on how to achieve just what you need. (Link to Database Journal) Calculating Days of the Week and Accounting Months 5-4-4

Happy New Year!

If this is your first time visiting my blog, welcome! For those who are returning, welcome back! SqlThis is aimed at being a quick "Reference" site. In general I do not write a whole lot of fluff about the topics at hand, just the absolute necessary to help understand the script/example and that's it, in some ways SqlThis is a repository of Tsql Links, but often times when I've run into unique solutions or solutions that I want to revisit, I will post them here too, so it's sort of a mesh of links and articles. I also get tips and tricks from fellow DBAs in the community that will provide me w/ Articles or Links. I hope this year to get a new tip/trick at least once a month. I've been posting to this blog for almost 2 years now. Next month will actually be my 2 year anniversary. And while other sites give away Ipods and Laptops (google microsoft laptop giveaway). I will be providing something much more coveted... ... more tsql code :)

10 mistakes to avoid

A very good read for even the most veteran of developers, the following top 10 mistakes list is not necessarily the top 10 mistakes of all time, but it is a good guideline... SQL Server query design: 10 mistakes to avoid

Vadivel's blog: Avoid using sp_rename ...

Vadivel's blog: Avoid using sp_rename ...

Finding your group(file)

Managing tables into filegroups can be a very daunting task when you start to look at huge database systems. The following script always helps me to locate what table is in which filegroup. It helps to keep things neat and tidy. SELECT o.name, s.groupname, f.name FROM dbo.sysfilegroups s INNER JOIN dbo.sysindexes i ON i.groupid = s.groupid INNER JOIN dbo.sysfiles f ON f.groupid = s.groupid INNER JOIN dbo.sysobjects o ON i.id = object_id(o.name) AND i.indid in (0, 1)

How to spot a big table

There are plenty of tools out in the wonderful world of the web to provide you with this very detail of information. Do you need it? Well Gui's can be fun and down right useful when in the right environment. In my world I use software to help keep track of my LIVE/Production systems but, what about those other systems that are not really live, but are development and test. Sometimes you start to run out of room, and you wonder why... sometimes you want a quick count of the tables that either consume the most space in terms of disk, or rows... How can you do it quickly? The following snippet is not groundbreaking, but it does provide a valuable service. More importantly it answer the questions of... which table is bigger... which tables are unused. etc, etc. You can even take this to the next level and keep track of which tables grow the most by surveying all your databases. And if you really like GUIs you can graph a trend on which tables grow the most.. stuff that is alrea...

How Safe are your passwords?

Let's Face it, when working with Sql Server it does pose many security threats when unsecured, even while secure you have an ultimate login to try and crack. That of course is the "SA". Unless you set up your Sql Server to NT Authentication only, but sometimes you don't have much of a choice. The following article has some interesting methods to try and upgrade your passwords to be MORE secure. Find SA Password (Brute Force) Find Passwords (Dictionary) Analysis of Password Security Password Generator ASCII Table