LessThanDot Site Logo

LessThanDot

A decade of helpful technical content

This is an archive of the posts published to LessThanDot from 2008 to 2018, over a decade of useful content. While we're no longer adding new content, we still receive a lot of visitors and wanted to make sure the content didn't disappear forever.

Import directory of XML files into SQL Server 2005

Here is an interesting way to import a directory that contains XML files using SQLCLR and T-SQL. Realistically this type of process will be placed into an executable or windows service given your typical requirements. SQL Server probably should be an option, but more than likely a secondary option to windows development. In some cases like one I had a year or so ago, I did have to do this and thought I would share.

Read More...

How to pad positive and negative number with zeroes in SQL Server?

You have a table with integer values and you are required to always show 8 numbers, if the length of the number is less than 8 characters then you need to pad it. Of course stuff like this should be done at the presentation layer but we all know that sometimes that means reinstalling apps so SQL is the easiest way. Numbers like these are usually order or customer numbers.

Read More...

Blocking due to fragmented HEAP Tables

Late last night my blackberry went nuts again. Sometimes I like that and sometimes I just want to keep sleeping. I know it may be a little odd to say I like having my database servers page me in the middle of the night, but troubleshooting problems is a major reason I went into the database administration field. Turns out the pages were all about blocking issues. Once I went into the blocks and drilled to batches that were abusing my database server, I found the reason to be a matter of fragmentation on a HEAP table.

Read More...

Please Mr. DBA, Change default passwords and use strong passwords

It’s your job to make sure security is not compromised. Part of that job is to make sure installations out of your control have not been left with default passwords set. If the passwords are controlled in the applications, then you have little control other than complaining until your blue in the face. If the accounts are SQL Authentication then they are in your control and you need to fix it.

Read More...

An Invisible Project is a Failed Project

What is a Project Most people, on hearing the term ‘project’, immediately think of the long, drawn out affairs including large percentages of the company attempting to achieve business-transforming achievements. However if we look at projects based simply on the number and type that occur, we find that a far greater percentage are small affairs with short timespans, small goals, and smaller teams. These smaller projects consume the resources that aren’t on the larger projects, account for the resources from those larger projects when the larger project is not active, and often have little to no natural visibility when viewed beside the game-changing larger project.

Read More...

Split string in SQL Server 2005+ CLR vs. T-SQL

I’m editing in a link to Adam Machanic’s blog on this. In the comments on this topic here you will see there are imperfections found in my methods. Reading Adam’s blog shows this in more detail. http://sqlblog.com/blogs/adam_machanic/archive/2009/04/26/faster-more-scalable-sqlclr-string-splitting.aspx Thanks Adam! I wrote this short CLR split function awhile back based on a few other articles I read when 2005 was released. I decided to play with it today and see if I could put it with the SQL split solutions.

Read More...

What makes a successful SQL Server Reporting Services implementation?

End of the day and I thought I’d offer this up to read and think about. What makes a good SQL Server Reporting Services implementation? I think to answer this you have to ask yourself what would make a bad implementation. First and foremost, if the report rendering process is slow, then it has failed. Second, can you gain access securely and without compromising the internal and external systems? Last, can the implementation allow for rapid report generation in order to supply the company with reporting abilities required to function smoothly?

Read More...

Distance Calculation Showdown

A while back George, Denis and I did a series of posts on calculating distance between sets of latitude/longitude coordinates. Those posts can be found here. Part 1: T-SQL Part 2: Geospatial Data Type (2008) Part 3: CLR (2005 +) At the time I promised to run some tests. I had an idea how it would turn out at that point, but wanted to make my testing a bit more thorough.

Read More...

SQL Friday, The Best SQL Server Links Of The Past Week Episode 18

Time for another episode of the SQL Friday, The Best SQL Server Links Of The Past Week show. Here is what I found interesting this past week in SQL Land: Backup Log with Truncate_Only Brent Ozar (without Hulk hands) explains in a video why backup log with truncate_only is a dangerous command with serious consequences. Learn why this might not be the best way to free up drive space on your SQL Server.

Read More...

How to make a spamfree paypal donate button

Thz following piece of code demonstrates the normal way of making a donate button that uses your paypal account. html <form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="email@you.us"> <input type="hidden" name="item_name" value="yourvalue"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="amount" value="100.00"> <input type="submit" value="$100.00" name="submit100" alt="Make payments with PayPal - it's fast, free and secure!"> </form> What is wrong with this? Well, it has an email address that is associated with your paypal account in there in plain text and spambots are still active and will harvest it sadly.

Read More...