Tag Archives: Sql

MS SQL rename column

exec sp_rename ‘tableName.ColumnName’, ‘newColumnName’, ‘COLUMN’

EXEC sp_rename 'LeadTracking.cSource', 'cSourceLookupId', 'COLUMN'

Original source

Leave a comment

Posted by on May 19, 2011 in SQL



Get all columns of a certain type from database

How do you get all the tables and columns in your database where the type is like money?

select as tableName, as ColumnName,
    t.Name as ColumnType,
    o.type as ObjectType, as SchemaName
from syscolumns c
inner join sysobjects o
inner join sysusers u
    on u.uid= o.uid
inner join sys.types t
    on t.system_type_id = c.xtype
where t.Name like '%money%'

Leave a comment

Posted by on April 12, 2011 in SQL