sp里拼接html table标签

DECLARE @xml NVARCHAR(MAX)    

--generate mail body    
SET @xml =    
CAST((    
SELECT 
        --[ID] 'td',''    
  --    ,[Status] 'td',''   
  --    ,[FM_ID] 'td',''    
  --    ,[BADNumber] 'td',''    ,
       [BADID] 'td',''   
      ,[Amount] 'td',''   
      ,[Creater] 'td'--,''   
      --,[Transfer_VendorCode] 'td'
  FROM [BAD].[dbo].[t_BADReceipt]
  --where Status=0 and [DataStatus]=1
  --and BADID<>''
order by ID desc    
FOR XML PATH('tr'), ELEMENTS ) AS NVARCHAR(MAX))    
  print @xml

 

posted @ 2015-07-26 14:20  yufeiyunsui  阅读(337)  评论(0编辑  收藏  举报