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.

Win A Copy Of SQL Server 2008 Administration in Action

Rod Colledge was so kind to give the readers of Less Than Dot a chance to win a pdf copy of his book SQL Server 2008 Administration in Action. Here is how you can win, read the Interview With Rod Colledge About The Book SQL Server 2008 Administration in Action post and tell me which question or answer you liked the most and why. Leave a comment on that post, do not leave it here.

Read More...

Interview With Rod Colledge About The Book SQL Server 2008 Administration in Action

I read SQL Server 2008 Administration in Action and really like this book, I have reviewed SQL Server 2008 Administration in Action here: Review of SQL Server 2008 Administration in Action I decided to ping Rod Colledge about doing an interview and he said yes. Some of the questions came from our forum users in the following thread: http://forum.lessthandot.com/viewtopic.php?f=17&t=8089 Below is the interview. What level of competence should a reader have before reading this book?

Read More...

Quick and Dirty Enum Mapper for Fluent NHibernate

I ran into a funny issue recently using Fluent NHibernate. Saw that it was storing enums as Strings in the database, or more accurately storing them as MySQL’s Enum Data Type. I would prefer to store them as integers so that behavior is the same as other databases, and refactoring gets easier. Hacking around in Fluent NHibernate I found the following: Map(x => x.Property).CustomType<SomeType>(); It had a slightly different name in the previous versions (I think it was CustomTypeIs), not sure if the same thing happened there (I did not notice it until using the latest).

Read More...

Decimal and Numeric problems when you don't specify precision and scale

When you don’t specify the precision and scale for your decimal data types, SQL Server will use its own default values, which is probably NOT what you want. In fact, the default precision and scale values are 18,0. If you want a whole number data type, use bigint, int, smallint, or int. If you want fractional numbers use DECIMAL, but ALWAYS specify the precision and scale. For example: Declare @Blah Decimal Set @Blah = 65.

Read More...

Derived Column and the Data Flow Task

In many cases you will find yourself in the position of having multiple data sources that you need to bring into one centralized destination. In that transport, many times over you will need to add columns for identifiers or other pointers that are required for later usage. This as you can see, starts going down the warehouse loading discussion. For this I don’t want to go that far into it though.

Read More...

To SA or not to SA

The question was raised again if SA should be disabled. First, it doesn’t matter if you do not utilize SQL Server Authentication. The account is then disabled in the first place. Most instances have mixed mode enabled however so SA is a major concern and a huge pet peeve of mine. So to put it lightly… I want to get some things out of the way first that I believe in and go about while having SA on my database servers

Read More...

T-SQL To find Out If An Index Is Clustered Or Non Clustered

I saw this question in in Google Analytics from a Google search that hit our site. So, how can you determice if an index is clustered or not? There are two ways, you can use either the INDEXPROPERTY function or the sysindexes/sys.sysindexes system table/view To see how it works we will create a table with one clustered and one non clustered index on it Here is the code for that

Read More...

Do we need to know basic math as programmers?

This is kind of a semi rant so if you don’t like to read those kind of things feel free to skip this post. How much math does a programmer need to know to do his job? These days with all the frameworks that exists you don’t need to know how to do a square root, a power function or a quick sort these will likely already be built in. What perplexes me is that someone would come out with a function to flip a sign.

Read More...

Calculating The Percentage Of Null Values In A Column With Transact SQL

What is the percentage of null values in a table for a column? This question comes up every now and then and it is pretty easy to answer this question We will start by creating the following table CREATE TABLE #perc ( Column1 INT,Column2 INT,Column3 INT) INSERT INTO #perc SELECT NULL,1,1 UNION ALL SELECT 1,1,1 UNION ALL SELECT NULL,NULL,1 UNION ALL SELECT NULL,1,NULL UNION ALL SELECT NULL,1,1 UNION ALL SELECT 1,1,NULL UNION ALL SELECT NULL,1,1 UNION ALL SELECT 2,1,2 UNION ALL SELECT 3,1,1 There are a couple of ways to calculate this but first we need to understand one thing: COUNT(*) and COUNT(ColumnName) behave differently, COUNT(*) will count NULLS while COUNT(ColumnName) does not!

Read More...

Five Google Wave Invitations are up for grabs

I have 5 Google Wave Invitations that I will give away today All you need to do is leave a comment with your twitter user name telling me why you think you need a Google Wave invite. I will pick 5 people randomly and today at 5PM EST I will DM the winners Keep in mind that the invites won’t be activated right away, according to the wave team Invite others to Google Wave

Read More...