首页 > 代码库 > 标量值函数

标量值函数

USE [instrument]
GO
/****** Object: UserDefinedFunction [dbo].[fn_getDspKeywordDetail] Script Date: 08/08/2014 15:53:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[fn_getDspKeywordDetail]
(@SellKeyWordId bigint)
RETURNS varchar(6000)
AS
BEGIN
DECLARE @keywords varchar(6000),@keyId varchar(6000)
SET @keywords=‘‘

select @keywords= @keywords+ isnull( ( Lexicon),‘‘)+‘,‘ from (
select distinct top 12 Lexicon from IM_Dsp_Ad_Sell_KeyWord_Detail left join Search_Lexicon on IM_Dsp_Ad_Sell_KeyWord_Detail.LexiconId=Search_Lexicon.Lexicon_id
where SellKeyWordId=@SellKeyWordId) b

RETURN @keywords
END