Thursday, February 9, 2012

Line Break in SQL Server 2005



I have created a stored procedure and include line break logic

Create Procedure GeneratePieChartEnforceblePie  
@ClientId varchar(50),  
@FromDate varchar(50),  
@Todate varchar(50)  
   
As  
DECLARE @fromD DATETIME
DECLARE @toD DATETIME
DECLARE @NewLineChar AS CHAR(2) --This is used for Line Break and set its value
SET @NewLineChar = CHAR(13) + CHAR(10)                                
SET @fromD = CONVERT(datetime,@FromDate,103)                                  
SET @toD = CONVERT(datetime,@Todate,103)      
Begin  

 
select   ('Rec '+DispCode +'-'+ShortDesc+'-'+'Number of Cases ' +Cast(count(fullref) AS varchar(50))+  @NewLineChar + 'Cash value of Segment £ '++Cast(sum(Amt) AS varchar(50)) ) as 'Code',count(cid) as Cnt, DispCode, ShortDesc , sum(Amt) as Amt from vw_EnfPie
 where cclientid=@ClientId  and convert(datetime, entrydate, 103) between convert(datetime, @FromDate, 103) and convert(datetime, @Todate, 103)
 group by DispCode, ShortDesc order by cast(DispCode as numeric)
End




No comments:

Post a Comment