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