复制代码 代码如下:
GO
/****** Object: UserDefinedFunction [dbo].[fun] Script Date: 11/22/2011 16:09:45 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create function [dbo].[fun](@type nvarchar(10))
returns nvarchar(200)
as
begin
declare @re nvarchar(200)
declare @code nvarchar(200)
set @re=''
set @code=''
select @re=@re+productCode+',' from T where type=@type group by productCode
select @re=left(@re, len(@re)-1)
return @re
end
新闻热点
疑难解答