CREATE PROCEDURE CheckTable
@TableName varchar(50)
AS
BEGIN
SELECT name AS [Column Name], --length,xtype,
CASE xtype
WHEN 56 THEN 'int'
WHEN 167 THEN 'varchar(' + convert(varchar(10),length) + ')'
WHEN 61 THEN 'dateTime'
WHEN 104 THEN 'bit'
WHEN 52 THEN 'smallint'
WHEN 175 THEN 'char(' + convert(varchar(10),length) + ')'
END AS [Column Type]
FROM syscolumns
WHERE id IN ( SELECT id FROM sysobjects where name = @TableName )
RETURN
end
GO