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. Comments are moderated so do not panic if you don’t see your comment right away.
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.
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? Is this book good for accidental DBAs?
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). Anyway I was mapping my properties like shown above, and it seemed all was well. Until I noticed a strange thing in the SQL written to the output window. What I was expecting to see was a single select statement for the primary entity, and another three select statements to fill a couple of collections contained in the object. I saw these, and one unwelcome guest.
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.00 SELECT SQL_VARIANT_PROPERTY(@Blah, 'BaseType') AS [Base Type], SQL_VARIANT_PROPERTY(@Blah, 'Precision') AS [PRECISION], SQL_VARIANT_PROPERTY(@Blah, 'Scale') AS [Scale] When you run the above code, you will see:
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. I want to show a brief and simple example you can run through in order to give you an idea of the power behind adding key indicators to those imports quickly with little amount of change to the source.
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
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
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. So if the number is 5 make it -5 and if it is -5 make it 5. Isn’t this simple math? Multiply by -1 and you are done!!
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!!!**
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