How to count records in table and send email only if count 0
I thought this would be fairly simple, but apparently not. I'm trying to count the number of records I have in my staging table, and send an email if count > 0 . . . . and . . . . I want to put the count in the body of the email.
I'm running into a problem with the concatenation part of it.
SET NOCOUNT ON
SELECT * FROM [dbo].[Staging]
SELECT @@rowcount as Row_Count
SET NOCOUNT OFF
IF @@rowcount > 0
BEGIN
exec msdb.dbo.sp_send_dbmail @profile_name = 'MailTest',
@recipients = '[email protected]',
@subject = 'Successfully Loaded Production',
@body = 'Successfully Loaded Production ' + @@rowcount + ' records loaded',
@body_format = 'text'
END
The problem comes from the '+' character not being recognized. Maybe it's out of scope, not sure.
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.
Try this
SET NOCOUNT ON
IF EXISTS (SELECT TOP 1 1 FROM [dbo].[Staging])
BEGIN
exec msdb.dbo.sp_send_dbmail @profile_name = 'MailTest',
@recipients = '[email protected]',
@subject = 'Successfully Loaded Production',
@body = 'Successfully Loaded Production ' + @@rowcount + ' records loaded',
@body_format = 'text'
END
Thanks
Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers
Similar Messages
-
how can I record a guitar and my voice (only voice with mic) at the same time ? I have one interface with Input 1 mic, Input 2 guitar, everything is working correct, but how can I activate multi recording or something like that... thanks
Set your inputs on your channel strips and make sure you have one set to input 1 and the other input 2. Arm the 2 audio tracks(the "R" in the track header. They will turn red and flash), then hit the record button.
-
Hi,
i am trying to have such kind of functionality, so that if any servers in sharepoint farm failed then it will send notification email to specific user that server is not able to ping or failed. Right now following script is working but it sending mail either
servers are all running or dead. But i would like to send email only if any of the server failed to ping. what i need to modify following code to work.
Thanks in advanced
#### Provide the computer name in $computername variable
$ServerName = "localhost","Dc-XX"
$smtp = "ExchChange"
$to = "[email protected]"
$from = "[email protected]"
$sub = " Server Status"
$body = @"
##### Script Starts Here ######
foreach ($Server in $ServerName) {
if (test-Connection -ComputerName $Server -Count 2 -Quiet ) {
$body += write-output "$Server is alive and Pinging `n"
} else { $body += Write-output "$Server seems dead not pinging `n"
$body
send-MailMessage -SmtpServer $smtp -To $to -Subject $sub -Body $body -From $fromyou need to put a check on the send-mailmessage if no ping fails then exit else send the email with message.
also try this script, performing the the same thing but more granular way
http://gallery.technet.microsoft.com/scriptcenter/d0670079-6158-4dc5-a9da-b261c70e4b7d#content
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog -
How do I record an audio and send to a friend?
Hi,
I'm sure there is a much better forum on which to place this question, but is there a way I can record an audio on my iMac without a corded microphone and send it via email to someone or use it another way?
A side note to that would be what might be an inexpensive corded mic to get?
Thanks much,
Lee
P.S. I just began using Skype and will be wanting to purcahse a headset/mic
to make calls: if anyone knows what might work good with a Mac that would
be neat. Lots of questions. Total non-tech person here! Or... where would
I post a question like this "PS" here on a support forum?Use GarageBand. I have made some sound files on just the internal mic of the MacBook Pro and the iMac has a similar one.
Make a new project using the voice selection (delete the extra track -- it starts with male and female) and, once you get close to the mic input (test this to see how near you want to be), press the red record button.
When you have finished, use the Share menu and send the file to disk. Once there you can attach the file to email easily. When exporting, select the mp3 format as that is universal.
As to a microphone, if you use one that goes into the mic port, you will probably need an amplifier. A USB mic is going to be more expensive, but of good quality. It depends what you are going to need it for. -
I have just recorded on garageband and now need to send away for editing how do i place in file and send
Send where? Edit how?
-
How to link Azure database tables and fields to VS2012 C++ entry form
We are using Visual Studio 2012 C++ and have successfully connected to the database on Azure, but do no know how to associate the database tables and fields with the C++ application data entry forms. Can anyone help? Thanks
Hello Roxanne,
You could use Entity framework to map classes to Azure tables. Please refer http://www.codeproject.com/Articles/363040/An-Introduction-to-Entity-Framework-for-Absolute-B to
learn more. Hope this helps.
Regards,
Kumar Bijayanta -
Please help me how concatenate all the error messages and send it as out parameter value.
Hi Experts,
Please help me how concatenate all the error messages and send it as out parameter value.
Thanks.Agree with Billy, exception handling is not something that is done by passing parameters around.
PL/SQL, like other languages, provides a suitable exception handling mechanism which, if used properly, works completely fine. Avoid misuing PL/SQL by trying to implement some other way of handling them. -
How do I record myself singing and playing and still be able to manipulate the volume of either the voice or the guitar? Or is that possible? I have a single mic.
GarageBand cannot unix audio files and split them into separate tracks.
Record the guitar and the vocals to separate tracks. If you only have one microphone, record both tracks separately, one after the other. -
How can I purchase an album and send it as a gift to another iPad user?
How can I purchase an album and send it as a gift to another iPad user?
iTunes Gift Options
http://support.apple.com/kb/HT2736 -
How to continously recorded the iput and output wave
I used NI-FGEN and NI-Scope in Bender element test a.I want to know how to continously recorded the input and output wave. Thanks you so much
I did a bit more looking and found out that I was wrong. My apologies. NI-HWS is currently shipping with the high-speed digital products and the waveform editors (analog and digital). It is not shipping with NI-FGEN or NI-SCOPE. sfpFile shipped with NI-SCOPE 2.1.2 through 2.5 and NI-FGEN 1.5. NI-HWS was not finished in time for the latest NI-SCOPE and NI-FGEN releases. For now, you will need to use sfpFile. Copy the examples to make your life much easier. Your application is simple enough that the basic functions should work for you. Don't worry about losing your data, since sfpFile and NI-HWS use the same format. In any case, it is all based on HDF5, and you can get HDF5 utilities (free for any use) from the NCSA website. A word of warning - HDF5 is VERY powerful, but also VERY difficult to use. sfpFile and NI-HWS are based on the 1.4.4 release of HDF5. The current 1.6.x release of HDF5 is file format compatible, but binary incompatible with the 1.4.x release. NCSA did not change the format of the files they are writing, but did change the code that writes to them.
This account is no longer active. Contact ShadesOfGray for current posts and information. -
How do I sign a document and send it
How do I sign a document and send it?@
Hi mstee,
I took a look at your account and see that you don't have any subscriptions. You would need either Acrobat or Adobe Fill & Sign (part of Acrobat.com). Here's some getting started information for Fill & Sign: Tutorial: Introduction to Adobe Fill & Sign
Best,
Sara -
Create and send email issue with UCCX/IP-IVR 8.0 script
Hi all,
I am facing issue with create and send email option with script. In my call flow there is an option to offer call to key in their phone number and script need to pass that phone number to supervisor as an email. I have created the script but every time when I key in the phone number is pass through the unsuccessful node. Please find the script as attachment.
Thanks and Regards,
AshfaqueHi How Yee,
Which version of UCCX/IPIVR you are using and what is the type of license? Because this feature is only supported with Premium License. Please check the UCCX data sheet from the below link.
http://www.cisco.com/en/US/partner/prod/collateral/voicesw/custcosw/ps5693/ps1846/data_sheet_c78-629807.html
You will get the information under "Integrated IVR Features with Server Software" of table:4.
Thanks and Regards,
Ashfaque. -
Reg: HRforms converted to PDF and send email to individual employee
Hi Experts,
The requirement is convert the HR form output to pdf and send email to respective employee in standard transaction. I copied RPCEDTX0 to ZRPCEDTX0 and include RPCEDS09 to ZRPCEDS09, the changes need to be done for individual PERNR, I have modified the include as shown below.
CALL FUNCTION 'HRPY_PROCESS_SET_PERNR_STATUS' after this, i have written my code
* start of changes ARAFIQUE
DATA: formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
fm_name TYPE rs38l_fnam,
pinfo LIKE pc407 OCCURS 0 WITH HEADER LINE,
pform type tt_pc408,
pform_l like pc408 OCCURS 0 WITH HEADER LINE.
IF xform[] IS NOT INITIAL.
pform_l = xform.
APPEND pform_1 TO pform.
pinfo-molga = '99'.
pinfo-forml = 'ZACC'.
APPEND pinfo.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = formname
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION fm_name
EXPORTING
pinfo =
pform = xform[]
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
* end of changes ARAFIQUE
I found out in internet that the smartform 'HR_ESS_PAYSLIP_TO_PDF' will convert to PDF and then i can send email to PERNRS.Hi Experts,
I have written the below code, the payslip is getting converted to PDF and it is getting saved in presentation server. I need to pick this file and mail, I created a customized function module for sending mail. I'm not able to send email to external addresses.
Please find my code below. I will post the function module later.
* start of changes ARAFIQUE
DATA: "formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
"fm_name TYPE rs38l_fnam,
p_info LIKE pc407 OCCURS 0 WITH HEADER LINE,
"pform type tt_pc408,
p_form LIKE pc408 OCCURS 0 WITH HEADER LINE,
pdf_content TYPE xstring,
pdf_fsize TYPE i,
lv_output_length TYPE i,
lt_binary_data TYPE STANDARD TABLE OF sdokcntbin,
it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
it_message LIKE solisti1 OCCURS 0 WITH HEADER LINE.
IF xform[] IS NOT INITIAL.
p_form[] = xform[].
p_info-molga = '99'.
p_info-forml = 'ZACC'.
p_info-pcols = 1.
p_info-psize = 1.
APPEND p_info.
CALL FUNCTION 'CONVERT_PAYSLIP_TO_PDF'
EXPORTING
p_info = p_info
IMPORTING
pdf_content = pdf_content
pdf_fsize = pdf_fsize
TABLES
p_form = p_form[]
EXCEPTIONS
empty_form = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = pdf_content
IMPORTING
output_length = lv_output_length
TABLES
binary_tab = lt_binary_data.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\Test\Testing.pdf'
filetype = 'BIN'
TABLES
data_tab = lt_binary_data
* FIELDNAMES =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
it_receivers-receiver = 'gmailid'.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
APPEND it_receivers .
it_message-line = 'Test for sending email'.
APPEND it_message.
CALL FUNCTION 'ZSEND_MAIL_ATTACHMENT'
EXPORTING
v_file_path = 'C:\Test\Testing.pdf'
v_subject = 'Test Mail'
TABLES
it_receivers = it_receivers[]
it_message = it_message[].
IF sy-subrc EQ 0.
COMMIT WORK.
* Push mail out from SAP outbox
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
ENDIF. -
Notification Template and send Email in oim 11g
Hi All
I need to send an email(html) format to users.I have created the a notificationtemplate through webconsole.
I am intrested to know are there any api's available in 11 g to access this particular notification template in my java code and send email to a user using this template.
iam referring to the class <oracle.iam.notification.vo.NotificationTemplate> and <Thor.API.OperationsInterface tcEmailOperationsIntf> classes but iam unable to access the notifcation template and send email.
Edited by: Bipin Patil on Jul 1, 2011 12:34 AMHi Rajiv Dewan
Your link was helpful iam able to connect the the notification template.
Now iam able to get the Template name,Subject,ID,Locale etc.
I have one small question how to get the message from the template using this api,
I referred the NotificationEvent,NotificationTemplate api's still iam not able to get message from my template and set message in my template.
Is there any other API's i need to explore to get message from notification template.
Thanks and Regards
Bipin patill
Edited by: Bipin Patil on Jul 1, 2011 5:29 AM -
Converting html file into zip file and send email attaching zip file
Hi Experts,
I am trying to send email with attachment(html). Which contains more than 7MB. So, It is throwing an error like Size exceeded.
So, Now i need to compress the data for less than 7MB.
I decided to convert HTML File into ZIP File.
Kindly suggest me to convert the HTML file into ZIP file and sending email with attached ZIP file.
Correct answer rewarded,
Thanks & Regards,
N. HARISH KUMARHi Experts,
*// HTML_TAB converting into ZIP File
DATA : zip_tool TYPE REF TO cl_abap_zip,
filename TYPE string ,
filename_zip TYPE string .
DATA : t_data_tab TYPE TABLE OF x255,
bin_size TYPE i,
buffer_x TYPE xstring,
buffer_zip TYPE xstring.
filename = text-007. "'HTML_TAB
*describe the attachment
DESCRIBE TABLE html_tab LINES tab_lines.
bin_size = tab_lines * 255.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = bin_size
IMPORTING
buffer = buffer_x
TABLES
binary_tab = html_tab.
IF sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*create zip tool
CREATE OBJECT zip_tool.
*add binary file
CALL METHOD zip_tool->add
EXPORTING
name = 'FSSAI_MAIL.HTML'
content = buffer_x.
*get binary ZIP file
CALL METHOD zip_tool->save
RECEIVING
zip = buffer_zip.
CLEAR: t_data_tab[],bin_size.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = buffer_zip
IMPORTING
output_length = bin_size
TABLES
binary_tab = html_tab.
Thanks & Regards,
N. HARISH KUMAR
Maybe you are looking for
-
[SOLVED] Problem with murmur after upgrading to 1.2.3-4
I've been running Murmur on my server for a long time without problems. The last version I had running was 1.2.3-3. After upgrading to 1.2.3-4, the already-running murmurd process crashed after a while (some hours after the upgrade, after constant us
-
How to populate Navigation List
Hi I need to populate a navigation list with values obtained from an RFC. Can I do this in the same way as populating DDBK? The DDBK is linked to a Context Value Attribute, but the Navigation List is linked to a Context Node. The context value attrib
-
Selecting/highlighting a node in Flex Tree using HierarchicalCollectionView as DataProvider
Hi, I am using GroupingCollection2 as the dataprovider for HierarchicalCollectionView. The GroupingCollection2 takes its data from an ArrayCollection. And finally I have a Tree whose dataprovider is the HierarchicalCollectionView . I want to acheive
-
Question over extending home network
Quick question please: I use a Time Capsule connected to a BT Home hub 3 for wifi at home. Works generally fine though patchy signal downstairs - question is, if I want to extend coverage indoors as currently some poor signal areas, would using Airpo
-
Does SOA 10.1.3 support Oracle DB 11.2?
Hi frdnz, I need the know supported oracle versions for SOA 10.1.3. A link to oracle site would be very helpful.. Thanks in advance. Lisan