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.

Refactor code by OdeToCode

Today on twitter I noticed that @OdeToCode (K. Scott Allen) this tweet. A Refactoring Experiment This leads to his blogpost about the experiment. Where you will find a link to the github page where the code can be found. And you will also found how to go about it. Here is the bad news: the new developer you hired has written some terrible, atrocious code. No one can understand what it does.

Read More...

Would you be interested in an information section for SQLCop?

George and I were thinking of adding a bunch of new checks/reports to SQLCop. SQLCop detects the following issues right now. Code Procedures with SP_ VarChar Size Problems Decimal Size Problem Undocumented Procedures Procedures without SET NOCOUNT ON Procedures with SET ROWCOUNT Procedures with @@Identity Procedures with dynamic sql Procedures using dynamic sql without sp_executesql Column Column Name Problems Columns with float data type Columns with image data type Tables with text/ntext Collation Mismatch UniqueIdentifier with NewId Table/Views Table Prefix Table Name Problems Missing Foreign Keys Wide Tables Tables without a primary key Empty Tables Views with order by Unnamed Constraints Indexes Fragmented indexes Missing Foreign Key Indexes Forwarded Records Configuration Database Collation Auto Close Auto Create Auto Shrink Auto Update Compatibility Level Login Language Old Backups Orphaned Users User Aliases Ad Hoc Distributed Queries CLR Database and log files on the same physical disk Database Mail Deprecated Features Instant File Initialization Max Degree of Parallelism OLE Automation Procedures Service Account SMO and DMO SQL Server Agent Service xp cmdshell Health Buffer cache hit ratio Page life expectancy I was thinking about adding an informational section to SQLCop and also some additional checks.

Read More...

Columnstore Index Basics

Columnstore Indexes are among one of the most talked about additions in SQL Server 2012. These indexes, used properly, can have an extremely high level of impact to performance and lowering overall IO and execution time of querying data that returns a high volume result set. The only thing columnstore indexes have in common with clustered and nonclustered indexes is the use of the term “index” in the name. This article will try to give you a look into columnstore indexing from a perspective of a DBA or Developer that is familiar with traditional indexing to tune execution plan.

Read More...

Will I See You At SQL Saturday #118 Wisconsin?

Saturday, April 21, 2012 will be an historic occasion: the first SQL Saturday will take place on Wisconsin soil! After attending many SQL Saturdays from Ohio to Portland over the past years, I decided we needed one in Wisconsin. We have a strong SQL community, with three user groups and many active professionals that want to learn and network. Madison, where “my” user group is based, seemed the perfect location – very central, and with great facilities.

Read More...

Please don't use blacklists, use parameterized queries or stored procs instead

Every now and then you will hear how some site will use a blacklist to ‘protect’ themselves against sql injection. Using a blacklist is very foolish because you can’t ever think of all the different ways that the bad guys will try to bypass your little list. Let’s say you have DROP and DROP TABLE in your list. What about these two PRINT REVERSE('tset ELBAT PORD') PRINT convert(VARCHAR(100),0x44524F50205441424C4520746573740000000000) Change PRINT to EXEC() and both will result in DROP TABLE Test

Read More...

Enabling 64-bit VM support on a HP Probook

When you have a 64-bit machine with a 64-bit OS, you just want you’re Virtual Machines to run in 64-bit mode. I use VMWare Player to run my VM’s but when I started the install of a 64-bit OS on the out-of-the-box configuration of my HP Probook I got this error message: The error message itself is clear, but where do you find the settings on you’re machine? Googling/binging will return lots of hits with posts from people asking the same question.

Read More...

Downloading SQL Server Sample Databases much improved with new CodePlex changes

Today Microsoft has improved the experience of downloading the sample databases for SQL server. As you can see from the image above, you can now quickly see all the different versions and all you have to do is click on the database that you are interested in. Gone are the days that you would have to search for the correct version, this is much improved..big thanks to Microsoft for this

Read More...

Dammit people, get to know check constraints and use them!

A couple of months back we were interviewing people for 2 positions, one of the questions I like to ask is the following: If you have a column in a table that’s an integer data type how can you restrict the values to be between 1 and 10? Most of the people start by saying that they restrict it in the application, when I ask how they would prevent from someone who has write access to do it they usually say that they would add a trigger.

Read More...

Dealing with the "The text, ntext, or image pointer value conflicts with the column name specified." error from Visual Foxpro

Recently my colleague sent me a strange error she was getting in our VFP application “The text, ntext, or image pointer value conflicts with the column name specified.” I was not getting the same error, so it was puzzling indeed. After some research online I found the following thread and suspected the problem was in the image size. And yes, after I chose a file about 2MB in size I was able to reproduce the same error.

Read More...

Institutional Knowledge

I recently was part of a company supported volunteer project. This project involved ten different people from various groups within my organization who had wanted to join the project – myself included. Indeed, I was the only one from my group but it did give me the opportunity to engage with other members of the organization that I may never have had the opportunity otherwise to meet. And, as is normal with a group of unfamiliar people, we spent some time learning about each other and the various departments we each work within.

Read More...