-----------------------------------------Second Procdure------------------------------
create proc dbo.sp0066_GetCategoryDescription
@CatID nvarchar(50)
as
if(select count(*) from [8SMerchant].[dbo].tb233CategoryDescription where iCDCatID=@CatID)>0
begin
declare @result nvarchar(2000)
set @result=''
select @result=@result+rtrim(vchrCDKeyWord)+',' from [8SMerchant].[dbo].tb233CategoryDescription
where iCDCatID in(select iCatID from [8SMall].[dbo].[fn004_GetSubCategory](@CatID))
set @result=left(@result,len(@result)-1)
select top 1 iCDCatID,(select @result) as vchrCDKeyWord,vchrCDTitle,vchrCDDescription,bCDRandom,iCDRandDay,iCDRandNum from [8SMerchant].[dbo].tb233CategoryDescription
where iCDCatID in(select iCatID from [8SMall].[dbo].[fn004_GetSubCategory](@CatID))
end
else
begin
select * from [8SMerchant].[dbo].tb233CategoryDescription where iCDCatID=0
end
-----------------------------------------Second Procdure------------------------------