Friday, January 28, 2011

T-SQL to Populate a Table of Country Codes with ISO 3166-1 Alpha-2 Codes and Names

You can use this query to populate a table with 2 character alpha country codes and their corresponding names.

Monday, January 3, 2011

CTP1 of SQL Server Denali (SQL Server 2011) will Blow up Your BIDS Dev Environment

If you already have SQL Server 2008 R2/SSIS installed you should not install the current CTP of Danali as BIDS 2008 will become unusable. Anytime you try to create a new project you will receive the following error:



'C:\Users\<username>\AppData\Local\Temp\temp.dtproj' cannot be opened because its project type (.dtproj) is not supported by this version of the application. 

To open it, please use a version that supports this type of project.
I suspect a reinstall of SSIS will correct the issue. For the moment I suggest a VM for the CTPs, should have taken my won advice!

Finding the Columns in a Database with Specific Names

You can use this T-SQL Query on SQL Server 2005 or greater to find all the columns that contain a word. In this example it would look for any column with the word number in it.

USE DataBase
GO

SELECT table_name
      ,column_name 'Column Name'
      ,data_type 'Data Type'
      ,character_maximum_length 'Maximum Length'

FROM information_schema.columns
WHERE column_name LIKE '%number%'
GO