Showing posts with label e-mail. Show all posts
Showing posts with label e-mail. Show all posts

Monday, March 26, 2012

Getting string part based on some character in MSSQL

Hi,
I have one Req where I have to get the portion of the string ,like I have one e-Mail iD "shivendra.narayan@.rediffmail.com". I need only rediffmail.com now. Means to say get the string after the '@.'

PLZ help me

Thank You,
Shivendra

Quote:

Originally Posted by shivendra

Hi,
I have one Req where I have to get the portion of the string ,like I have one e-Mail iD "shivendra.narayan@.rediffmail.com". I need only rediffmail.com now. Means to say get the string after the '@.'

PLZ help me

Thank You,
Shivendra


-----------

Declare string_index int
Declare col_length int
select string_index = PATINDEX('%@.%', columnname),
col_length = length(columnname)
FROM tablename
WHERE 'Write your condition here'
Now, you can use the query below to return the
SELECT SUBSTRING(columnname, string_index, (col_length - string_index))
from tablename WHERE 'Write your condition here'

Hope this helps!!
Thanks!
Santhosh

Monday, March 19, 2012

Getting Results in an EMail PDF?

We have the following proc that executes an e-mail and attaches the resulting query as a TXT attachment. Is there a way to make the attachment be a PDF?

@.MYRECIPIENTS varchar (500)

, @.MYSUBJECT varchar (50)

, @.MYBODY varchar (500)

, @.MYQUERY varchar (1000)

, @.MYIMPORTANCE varchar (10)

, @.MYPROFILE varchar (50)

as

declare @.NewSubject varchar(200)

set @.NewSubject = @.MYSUBJECT + ' ' + Cast(GetDate() as varchar(20))

Execute msdb.dbo.sp_send_dbmail

@.profile_name = @.MYPROFILE

,@.recipients = @.MYRECIPIENTS

,@.subject = @.NewSubject

,@.body = @.MYBODY

,@.query = @.MYQUERY

,@.importance = @.MYIMPORTANCE

,@.attach_query_result_as_file = 1

,@.body_format = 'HTML'

Jim,

That's not directly possible. As you recall, SQL Server isn't a printer client, and has no direct capabilities to interact with printers, and PDF is a printer format.

However, you may find some usefulness from a Google? search for a freely available stored procedure that is called "sql 2 pdf".

|||Thanks for the lead. I will follow up on it

Wednesday, March 7, 2012

Getting list of subscribed reports from the ReportServer database

I need to replace all instances of 1 e-mail address with another, this address is subscribed to multiple reports, and many of those subscriptions are set up to be sent to lots of e-mail addresses so the description field in the subscription table is not returning the full list (the description field is truncated after 55 characters so I can only see the first couple of e-mail addresses that are subscribed).

Where in the ReportServer database can I find a list of e-mail addresses subscribed to a report?

I have had a look around and can't seem to find where the information in the "To:" and "Cc:" and "Bcc:" fields are stored?

Thanks,

Paul.

Thats in the Subscriptions table of the ReportDB. The attribute Extensions settings stores the values of the email addresses, you can simply use a replace command on this XML data.


HTH, Jens Suessmeyer.

http://www.sqlserver2005.de