June 28, 2010 at 8:58 am
Hi,
I need help to get the rows affected by a querry in order to or not print a TableHTML formated:
SET @tableHTML =
-- N'<font face=verdana color=black size=2>Denna mail genererades automatskt kl: ' + @newStamp + '</font>
' +
N'<table width=1000 border=1 cellspacing=1 cellpadding=1 style=''border:solid windowtext 1.0pt''><tr>' +
N'<td width=70 bgcolor=#FF9900><font face=verdana color=black size=2> FakturaNr </td>' +
N'<td width=400 bgcolor=#FF9900><font face=verdana color=black size=2> Kund </td>' +
N'<td width=50 bgcolor=#FF9900><font face=verdana color=black size=2> Artnr </td>' +
N'<td width=300 bgcolor=#FF9900><font face=verdana color=black size=2> name</td>' +
N'<td align=left width=50 bgcolor=#FF9900><font face=verdana color=black size=2> Antal </td>' +
N'<td align=left width=40 bgcolor=#FF9900><font face=verdana color=black size=2> Enhet </td>' +
N'<td align=left width=100 bgcolor=#FF9900><font face=verdana color=black size=2> Fakturadatum </td>' +
N'<td align=left width=150 bgcolor=#FF9900><font face=verdana color=black size=2> User</td>' +
N'</tr></font><font face=verdana color=black size=2>' +
CAST ( ( SELECT td = '<font face=verdana color=black size=2>' + CAST(co.InvoiceNo as varchar(10)), '',
td = '<font face=verdana color=black size=2>' + CAST(co.CustomerNo AS VARCHAR(10)) + ' - ' + co.CustomerName, '',
td = '<font face=verdana color=black size=2>' + col.ArticleNo, '',
td = '<font face=verdana color=black size=2>' + col.Name, '',
td = '<font face=verdana color=black size=2>' + Replace(col.Invoiced,'.',''), '',
td = '<font face=verdana color=black size=2>' + col.QuantityPerUnitText, '',
td = '<font face=verdana color=black size=2>' + left(convert(varchar, col.created, 120),10), '',
td = '<font face=verdana color=black size=2>' + CAST(emp.UserNo AS VARCHAR(10)) + ' - ' + emp.Name
FROM AydinGLOBALData.Aydin.CustomerOrderLineCopy as col, AydinGLOBALData.Aydin.CustomerOrderCopy as co, AydinGLOBALData.Aydin.Employee as emp
WHERE col.QuantityPerUnitText='kg' and col.InvoiceNo = co.InvoiceNo AND col.CreatedBy = emp.UserNo
AND left(convert(varchar, co.invoicedate, 120),10) = left(convert(varchar, '2010-06-22', 120),10) and co.InvoiceNo>0
AND CAST(col.Invoiced AS decimal(10,2)) - CAST(col.Invoiced AS int)=0
ORDER BY CAST(co.CustomerNo AS VARCHAR(10)) + ' - ' + co.CustomerName
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>';
print @@ROWCOUNT ;
The result is:
1
mail queued.
What I need is to capture the rowws affected in a variable.
reguards
Mustapha
June 28, 2010 at 9:02 am
get the rows affected by what?
Dan
If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.
June 28, 2010 at 11:41 pm
I mean the rows selected if there is any.
What I want is:
If there is any rows then I send the mail
If not then I´ll skip the mail.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply