What Wordle thinks about my site

Friday, May 15th, 2009 | General | No Comments

Click on the image to see the Wordle aka Tag Cloud

Written by Deepak Vasa - Visit Website

Tags: , ,

Fixing WMI issues when upgrading SQL Server 2005 to SQL Server 2008

Thursday, March 26th, 2009 | General | No Comments

I found the post by Sydney on rebuilding the required SQL Server 2005 mof file highly useful, it worked for me...here's the post: http://thirdshelf.com/2008/08/13/rebuilding-wmi-repository/

Written by Deepak Vasa - Visit Website

Tags: , , ,

Using the field name alias in SQL Where clause

Tuesday, March 17th, 2009 | SQL | No Comments

Often I encounter SQL queries where I would love to use the alias names of my columns in the WHERE clause, today while trawling around the web I found a cool and easy way to do it. Here's an example:

WITH Customer_Info AS
(
SELECT (Surname + ', ' + Firstname) AS FullName,
(Address_Line_1 + ',' + Address_Line_2) AS Customer_Address
FROM Customers
)
SELECT FullName, Customer_Address
FROM Customer_Info
WHERE FullName LIKE 'Smith%'

Written by Deepak Vasa - Visit Website

Tags: , , , ,

MND

Tuesday, February 24th, 2009 | General | No Comments

Last week my Uncle's older Brother has passed away after an inspiring battle with cancer. I have met him only once in my life, but have heard a lot about him and his achievements. Today while googling about Divakar garu I found this blog post about him written by his friend & colleague "Knocking on Heaven’s door"

Written by Deepak Vasa - Visit Website

Query to get the column names/types for all tables in SQL 2005

Wednesday, February 11th, 2009 | SQL | 4 Comments

SELECT schemas.name AS [Schema],
tables.name AS [Table],
columns.name AS [Column],
CASE
WHEN columns.system_type_id = 34 THEN 'byte[]'
WHEN columns.system_type_id = 35 THEN 'string'
WHEN columns.system_type_id = 36 THEN 'System.Guid'
WHEN columns.system_type_id = 48 THEN 'byte'
WHEN columns.system_type_id = 52 THEN 'short'
WHEN columns.system_type_id = 56 THEN 'int'
WHEN columns.system_type_id = 58 THEN 'System.DateTime'
WHEN columns.system_type_id = 59 THEN 'float'
WHEN columns.system_type_id = 60 THEN 'decimal'
WHEN columns.system_type_id = 61 THEN 'System.DateTime'
WHEN columns.system_type_id = 62 THEN 'double'
WHEN columns.system_type_id = 98 THEN 'object'
WHEN columns.system_type_id = 99 THEN 'string'
WHEN columns.system_type_id = 104 THEN 'bool'
WHEN columns.system_type_id = 106 THEN 'decimal'
WHEN columns.system_type_id = 108 THEN 'decimal'
WHEN columns.system_type_id = 122 THEN 'decimal'
WHEN columns.system_type_id = 127 THEN 'long'
WHEN columns.system_type_id = 165 THEN 'byte[]'
WHEN columns.system_type_id = 167 THEN 'string'
WHEN columns.system_type_id = 173 THEN 'byte[]'
WHEN columns.system_type_id = 175 THEN 'string'
WHEN columns.system_type_id = 189 THEN 'long'
WHEN columns.system_type_id = 231 THEN 'string'
WHEN columns.system_type_id = 239 THEN 'string'
WHEN columns.system_type_id = 241 THEN 'string'
WHEN columns.system_type_id = 241 THEN 'string'
END AS [Type],
columns.is_nullable AS [Nullable]

FROM sys.tables tables
INNER JOIN sys.schemas schemas ON (tables.schema_id = schemas.schema_id )
INNER JOIN sys.columns columns ON (columns.object_id = tables.object_id)

WHERE tables.name <> 'sysdiagrams'
AND tables.name <> 'dtproperties'

ORDER BY [Schema], [Table], [Column], [Type]

Written by Deepak Vasa - Visit Website

Tags: , ,

Search

Pages