select dbo.FN_COL_TYPE ('SALES.CUSTOMER','customerid')
CREATE FUNCTION FN_COL_TYPE (@TBL_NAME VARCHAR(256),@COL_NAME VARCHAR(256))
returns varchar(256)
as
begin
DECLARE @vType VARCHAR(50)
select @vType = b.name from sys.columns a join sys.types b on a.system_type_id = b.system_type_id
where object_id = object_id(@TBL_NAME)
and A.name = @COL_NAME
return @vType
end
No comments:
Post a Comment