--스칼라 fn
CREATE Function fn_GetColumnLength(@soname nvarchar(50), @scname nvarchar(50))
RETURNS int
AS
BEGIN
DECLARE @Length int
Select @Length = Length From Sysobjects as so inner join syscolumns as sc on so.id = sc.id
where so.name =@soname and sc.name =@scname
Return @Length
END
Declare @ReturnValue int
exec @ReturnValue = dbo.fn_GetColumnLength 'MBoard', 'idx'
Select @ReturnValue
Select dbo.fn_GetColumnLength 'MBoard', 'idx'