February 9, 2018 at 6:45 pm
Comments posted to this topic are about the item HTML Table Results For Email
February 19, 2018 at 7:55 am
This was interesting and it generated an interesting result in my case.
Excellent header, but strange rows.....
Thanks!
Ken
kbaker20@humana.com
February 19, 2018 at 1:40 pm
A great way to do this! One thing I noticed is that the consecutive REPLACE functions at the end of the SP don't really do anything (i.e. they replace '<' with itself). I changed the code to this and it seemed to work: ... + REPLACE(
REPLACE(@BodyHTML, '<', '<') ,
'>' ,
'>') ...
Note: I have not fully tested this so use at your own risk
Thanks for the innovative approach
February 19, 2018 at 2:05 pm
I suspect posting it replaced the < and > with the HTML replacements. I also added a <TR> tag for the header which I believe is required for proper HTML form. I also noticed it's not fond of timestamp columns, but then again who is
set @ColumnHeader
= '<table cellpadding="2" cellspacing="2" border="1" style="font-family: Arial; font-size: 8pt"><TR>'
+ @ColumnHeader + '</TR>';
February 20, 2018 at 1:03 am
Thank you for this article. It works but the final HTML output is broken. I guess it has to do with the tags and since I am not well versed with HTML, I am having a hard time fixing this.
Here is how it looks in my email message:
Can anyone please help?
February 20, 2018 at 8:15 am
hoolash - Tuesday, February 20, 2018 1:03 AMThank you for this article. It works but the final HTML output is broken. I guess it has to do with the tags and since I am not well versed with HTML, I am having a hard time fixing this.Here is how it looks in my email message:
Can anyone please help?
Are you able to supply the table spec and some sample data?
February 20, 2018 at 8:17 am
kbaker91 - Monday, February 19, 2018 7:55 AMThis was interesting and it generated an interesting result in my case.Excellent header, but strange rows.....
Thanks!
Ken
kbaker20@humana.com
Would be keen to see the table and some sample data. May have missed something. Whilst no help to you, it works for the example we threw at it
March 14, 2018 at 7:53 am
I am having the same issue
Here is the data for your review
name User_Login enabled date_created date_modified step_id step_name command
Modification Test US\mar1jxm 1 2018-03-12 11:25:16.573 2018-03-13 17:06:26.183 1 Step 1 Select 50 +30 +10
Modification Test US\mar1jxm 1 2018-03-12 11:25:16.573 2018-03-13 17:06:26.183 2 Step 2 Insert Select 60
Modification Test US\mar1jxm 1 2018-03-12 11:25:16.573 2018-03-13 17:06:26.183 3 Step 3 Select 114
Jacob Milter
March 14, 2018 at 9:18 am
mar1jxm - Wednesday, March 14, 2018 7:53 AMI am having the same issue
Here is the data for your reviewname User_Login enabled date_created date_modified step_id step_name command
Modification Test US\mar1jxm 1 2018-03-12 11:25:16.573 2018-03-13 17:06:26.183 1 Step 1 Select 50 +30 +10
Modification Test US\mar1jxm 1 2018-03-12 11:25:16.573 2018-03-13 17:06:26.183 2 Step 2 Insert Select 60
Modification Test US\mar1jxm 1 2018-03-12 11:25:16.573 2018-03-13 17:06:26.183 3 Step 3 Select 114
Can you supply the table definition? As it work for me.
CREATE TABLE emailtest
(
Name NVARCHAR(100) ,
User_Login NVARCHAR(100) ,
enabled BIT ,
date_created DATETIME2 ,
date_modified DATETIME2 ,
step_id INT ,
step_name NVARCHAR(100) ,
command NVARCHAR(MAX)
)
INSERT INTO emailtest ( Name ,
User_Login ,
enabled ,
date_created ,
date_modified ,
step_id ,
step_name ,
command )
VALUES
('Modification Test', 'US\mar1jxm', 1, '2018-03-12 11:25:16.573', '2018-03-13 17:06:26.183', 1 ,'Step 1', 'Select 50 +30 +10'),
('Modification Test','US\mar1jxm', 1, '2018-03-12 11:25:16.573', '2018-03-13 17:06:26.183', 2, 'Step 2', 'Insert Select 60'),
('Modification Test', 'US\mar1jxm', 1, '2018-03-12 11:25:16.573', '2018-03-13 17:06:26.183', 3, 'Step 3', 'Select 114' )
DECLARE @GeneratedHTML NVARCHAR(MAX);
EXEC dbo.sp_GenerateHTMLTableResults @ResultsTableName = N'dbo.emailtest' , -- nvarchar(100)
@GeneratedHTML = @GeneratedHTML OUTPUT -- nvarchar(max)
PRINT @GeneratedHTML
March 14, 2018 at 1:58 pm
Thank you very much for your reply.
I ran your script AS IS and got the same result.
Any ideas?
Jacob Milter
March 14, 2018 at 2:13 pm
Hi again!
As a test I created a html file and opened it in IE.
Same result!
Jacob Milter
Viewing 11 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy