loonison101
11/12/2015 - 1:03 PM

view_column_report_1.sql

declare @schemaName nvarchar(100) = 'item'
declare @tableName nvarchar(100) = 'location'
declare @dataType nvarchar(100) = 'decimal'

select
	s.name,
	t.name,
	c.name,
	c.is_nullable,
	st.name
from sys.columns c
	inner join sys.tables t
		on t.object_id = c.object_id
		and t.name = @tableName
	inner join sys.schemas s
		on s.schema_id = t.schema_id
		and s.name = @schemaName
	inner join sys.types st
		on st.system_type_id = c.system_type_id
		and st.name = @dataType