Monday, September 28, 2009

Windows 7 Launch Party

Attended the Windows 7 and Server 2008 R2 launch party in Atlanta today.

It was interesting to see the sensor demos so I thought I'd post a quick note about it if anyone is interested.

Having Fun link

Monday, September 21, 2009

Pad Integer with Zeros using C#

A quick example for padding an Integer with zeros in C#:

System.Int32 intMyInteger = 87366;
System.String strMyInteger = intMyInteger.ToString().PadLeft(20, '0');

Thursday, September 10, 2009

SQL Change Table Owner

Need a quick way to change the table owner for multiple tables then try this:


DECLARE @old sysname, @new sysname, @sql varchar(1000)

SELECT
@old = 'CHANGE_name_here_ONLY'
, @new = 'dbo'
, @sql = '
IF EXISTS (SELECT NULL FROM INFORMATION_SCHEMA.TABLES
WHERE
QUOTENAME(TABLE_SCHEMA)+''.''+QUOTENAME(TABLE_NAME) = ''?''
AND TABLE_SCHEMA = ''' + @old + '''
)
EXECUTE sp_changeobjectowner ''?'', ''' + @new + ''''

EXECUTE sp_MSforeachtable @sql

Swidget