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.

Replace Your Case When Then Else Syntax With the Sign Function In SQL Server

If you want to show a 1 when there is a value for something in the column and 0 if none of the rows have that values you typically do something like this CASE WHEN SUM(CONVERT(INT,SomeValue)) > 0 THEN 1 ELSE 0 END Basically you sum it up and if the sum is greater than 0 then you show 1 otherwise you show 0 Here is what it might look like in code

Read More...

Obviously!

Recently, I was having to test an application to which I had made some modifications to fix an error that had been discovered. In the course of testing the changes I had done, I found myself with an error that was disturbingly familiar. The application was an ASP app and the error was a server.createobject error indicating that the object could not be created. I have come across this error at least a few times previously but it had been a while.

Read More...

Use FOR XML AUTO,TYPE, ELEMENTS to get XML in the format you really want with SQL Server FOR XML Syntax

If you use the FOR XML syntax in SQL Server it can be a little tricky to get the XML formatted the way you really want it. For every table that you have in a join it becomes a child of the table before. What if you have a 3 table join and you want one table to be the parent and the two tables that you are joining to be on the same level, I will show you how you can accomplish that.

Read More...

How to Install Internet Information Services (IIS) On Windows 7

If you are upgrading from windows xp to windows 7 there is a change in the way you install Internet Information Services. On windows xp you would install IIS from add/remove windows components. This is different in Windows 7; it is very similar how it is done on Vista. Go to Control Panel and click on Programs, on the following screen click on Turn Windows features on or off (see image below)

Read More...

Having Fun With OPENQUERY And Update,Delete And Insert Statements

Recently I had to do some data manipulation against a Sybase linked server running on a Unix box. When you have a linked server you can use OPENQUERY do perform DML statements like delete, update and inserts but the syntax is a little different So let’s look at some code, first create a linked server on your machine that is linked to your machine. You can add a linked server through the wizard or through the sp_addlinkedserver stored proc

Read More...

Dealing with A transport-level error has occurred when sending the request to the server errors

This question was asked yesterday in our forums A transport-level error has occurred when sending the….. by Impal3r When i have a query window open In SSMS and I step away for a while and then I run the query I get the following error A transport-level error has occurred when sending the request to the server what I do then is disconnect from the server, connect again and then I can open anew query window to run the query again.

Read More...

Listing All The User-Defined Data Types That Were Created On Your SQL Server

If you have a bunch of User-Defined Data Types in your databases and you would like to get a list of them then you can run the following query On SQL Server 2000 and up select * from systypes where xusertype > 256 or On SQL Server 2005 and up SELECT * FROM sys.Types WHERE is_user_defined = 1 Let’s take a look how this works by adding a couple of User-Defined Data Types.

Read More...

Review Of Beginning Spatial With SQL Server 2008

I will just start of by saying that Beginning Spatial With SQL Server 2008 written by Alastair Aitchison is a truly awesome book. Although I have tinkered a little with the new geospatial capabilities in the SQL Server 2008 Proximity Search With The Geography Data Type blog post I did not really understand or know that there were so many nuances and things that you had to be careful about.

Read More...

Bing, worth switching from Google?

Bing is the latest version of a search engine developed by Microsoft. Microsoft was developing and testing for the last couple of months a search engine with the name Kumo which in Japanese means spider or cloud. Kumo was of course just the code name for what would become eventually Bing. Search is very important because 1% of the search market is roughly worth 1 billion dollars. This means that the number two player can make some decent money.

Read More...

How to mount ISO images on Vista or Windows 7

Every time you buy a new computer you of course need to install a bunch of software. In my case this would be stuff mostly from MSDN _Visual Studio 2008 + Service pack 1 SQL Server 2008 + Service pack 1 Expression Studio 2 Win XP SP 3 (to run on a virtual machine) Windows 7 RC (to run on a virtual machine) Visual Studio 2010 (to run inside the Win 7 virtual machine)

Read More...