[SQL ] 關於sql組成html語法欄位名稱的問題

作者: oherman (qq)   2016-06-30 10:48:48
資料庫名稱:SQL server
資料庫版本:2012
內容/問題描述:
在網路上找到由sql 組成html table的語法
select td = dbtable + '</td><td>' + cast( entities as varchar(30) ) +
'</td><td>' + cast( rows as varchar(30) )
from (
select dbtable = object_name( object_id ),
entities = count( distinct name ),
rows = count( * )
from sys.columns
group by object_name( object_id )
) as d
for xml path( 'tr' ), type
產生資料
[no name]
<tr><td>....</td></tr>
但需要用程式將此table資料html語法email出去,請問我要怎麼改才能變成
[htmlbody]
<tr><td>....</td></tr>

Links booklink

Contact Us: admin [ a t ] ucptt.com