create function [dbo].[f_getcolsByName](@tableName varchar(50)) returns varchar(1000)
as
begin
declare @cols varchar(1000)
select @cols=''
select @cols+=name+',' from syscolumns where id=OBJECT_ID(@tableName)
if @cols<>''
begin
select @cols=SUBSTRING(@cols,1,len(@cols) -1)
end
return @cols
end