IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[F_DanHao]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[F_DanHao]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

create function [dbo].[F_DanHao](@gid varchar(50),@word varchar(16))   
    returns nvarchar(200)   
    as   
       begin      
          declare  @S nvarchar(200)      
          select @S=isnull(@S,'')+billno+',' from ch_fee_do where feeid=@gid and billno like @word      
          return @S   
      end   
GO


