HOw to get an Alert based on a Query
I currently have a maintenance plan in place that does a backup, re-indexing, etc.. If a task fails, it sends me an email alert. I would like to add a "T-SQL Statement Task" that will execute a query and send me an email alert based
on the results of the query.
For example: Select Cast(case when count(inventory.items) > 1000 then 1 else 0 End as bit) as SendAlert from Inventory
The maintenance plan's alert function constraint seems to be triggered whether the Query executed successfully or not RATHER THAN from the Query Result.
Can I accomplish what I want from within a maintenance plan or is there some other way to do this?
Thank You.
Jack
I would create a stored procedure using the following t-sql code:
Create Procedure [dbo].[GetInventoryAlert]
as
Begin
Set nocount on
declare @body varchar(max)
set @body = cast( (
select td = SendAlert + '</td><td>'
from (
select SendAlert = Cast(case when count(inventory.items) > 1000 then 1 else null End)
from Inventory) as d
for xml path( 'tr' ), type ) as varchar(max) )
If Len(Rtrim(@body))>0
Begin
set @body = '<table cellpadding="2" cellspacing="2" border="1">'
+ replace( replace( @body, '<', '<' ), '>', '>' )
+ '</table>'
Set @body='****BODY HEADING OPTIONAL****<br/><br/>'+@body
exec msdb.dbo.sp_send_dbmail @profile_name='MAIL PROFILE',
@from_address='FROM EMAIL ADDRESS',
@recipients='COMMA SEPARATED RECIPIENTS',
@subject='SUBJECT OF THE EMAIL',
@body=@body,
@body_format='HTML',
@attach_query_result_as_file=0,
@query_result_header = 0
End
End
Also the above can be embedded as t-SQL in a maintenance plan tasks control.
I would add an Execute T-SQL Statement Task. Then branch the task where applicable.
Similar Messages
-
How can we display Alerts based on Exceptions in BI7
Hi,
<b>How can we display Alerts based on Exceptions in BI7?</b> My requirement is a dashboard kind of scenario where the alerts will be displayed using WAD in Portal.
In 3.5, we used to schedule the alerts from the Reporting Agent and display that using the Alert Webitem in Web Application Designer. But I couldn't find the Reporting Agent and the Alert Webitem in BI7. I would like to know how we can do Exception Reporting in BI7. I appreciate your suggestions/comments. Thanks in advance.
Regards
HariHi,
Please go through this link:
bw 7.0
Regards,
Habeeb -
How to get fiscal period based on date and Fiscal year?
Hi Guys,
Can anybody tell me how to get Fiscal period based on date and Fiscal Year or fiscal year variant?
Thanks,
Gopi.Hi,
Please refer the code below:
*: Report: ZFISCALYR :
*: Date : 2004 :
*: Description: Demonstrates how to return the corresponding fiscal :
*: year and posting period for a company code and posting :
*: date or posting date and fiscal year variant. :
REPORT zfiscalyr NO STANDARD PAGE HEADING.
TABLES: ekko.
PARAMETERS: p_bukrs TYPE ekko-bukrs,
p_bedat TYPE ekko-bedat.
DATA: gd_fiscalyr TYPE bapi0002_4-fiscal_year,
gd_fiscalp TYPE bapi0002_4-fiscal_period.
DATA: gd_fiscalyr2 TYPE T009B-BDATJ,
gd_fiscalp2 TYPE bapi0002_4-fiscal_period.
DATA: gd_periv TYPE t009-periv.
*START-OF-SELECTION.
START-OF-SELECTION.
* get fiscal year and period - (requires date and company code)
CALL FUNCTION 'BAPI_COMPANYCODE_GET_PERIOD'
EXPORTING
companycodeid = p_bukrs
posting_date = p_bedat
IMPORTING
fiscal_year = gd_fiscalyr
fiscal_period = gd_fiscalp.
* Alternative fiscal year function module
* - (requires date and fiscal year variant code from T009 table)
* gets first entry in fiscal year variant table (will need to choose
* correct one from table rather than just using first entry)
SELECT SINGLE periv
FROM t009
INTO gd_periv.
* get fiscal year and period
CALL FUNCTION 'DETERMINE_PERIOD'
EXPORTING
date = p_bedat
* PERIOD_IN = '000'
version = gd_periv
IMPORTING
period = gd_fiscalp2
year = gd_fiscalyr2
EXCEPTIONS
period_in_not_valid = 1
period_not_assigned = 2
version_undefined = 3
OTHERS = 4.
*END-OF-SELECTION.
END-OF-SELECTION.
WRITE:/ 'From function module: BAPI_COMPANYCODE_GET_PERIOD',
/ 'Fiscal year is:', gd_fiscalyr,
/ 'Fiscal period is:', gd_fiscalp.
SKIP.
WRITE:/ 'From function module: DETERMINE_PERIOD',
/ 'Fiscal year is:', gd_fiscalyr2,
/ 'Fiscal period is:', gd_fiscalp2.
Thanks,
Sriram Ponna.
Edited by: Sriram Ponna on Apr 17, 2008 8:59 PM -
How to get BP kind based on user name?
Hi,
How to get BP kind based on user name?
Is there any table other than BUT000 which gives the Business partner no. and BP KIND?
What is BLUEPRINT table?Hi John,
do you mean Type:
1 Person
2 Organisation
3 Group
or Role like
000000 Business Partner (General)
BBP000 Vendor
BBP001 Bidder
BBP002 Portal Provider
BBP003 Plant
BBP004 Purchasing Company
BEA001 Billing Unit
BUP001 Contact Person
BUP002 Prospect
BUP003 Employee
BUP004 Organizational Unit
BUP005 Internet User
The Role can be found in BUT100.
Regards
Gregor -
How to get the alert context from scom event into incident description?
Hello,
I user SCO for creating incidents of SCOM events. My problem ist that in some events the most interesting information is standing in AlertContext. But I cannot add this text to the descritipn field of our incident tool. If I user the published variable Context
from MonitorAlert the creating of the incident fails. The right information is standing in the Params field of the Context content. But if I add the Params variable from MonitorAlert there is not the content given.
So how can I add the AlertContext information in my incident content?Hi,
I use the Publish Data Context from "Get Alert" and the xpath-Query below to get the short name of the service if Alert is "Windows service stopped".
I think it's difficult to have a default Query because the Context is too various fot all OpsMgr Alerts.
Regards,
Stefan
www.sc-orchestrator.eu ,
Blog sc-orchestrator.eu -
How to get current row(Based on Radio button check) submit button Click
Hi i hava Query Region Search(Based On Auto Customization Criteria).
For Showing Results iam Using Table Region.
Using Radio button How we get the row reference value using Submit button Click.
Please Help on this .
Thanks & Regards
SanHi san ,
Try this
if ("EventID".equals(pageContext.getParameter(EVENT_PARAM)))
String rowRef = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
OARow row = (OARow)am.findRowByRef(rowRef);
VORowImpl lineRow = (YourVORowImpl)findRowByRef(rowRef); // Replace your vo name .
Please refer this link , Let me know if its not clear .
Single Selection in table Region in OAF .
Keerthi -
How to get po number based on billing document number
Hi every body
how to get a po number based on billing document number
thanks in advance.
sekhar.kHi,
Check this field VBRK-BSTNK_VF.
Regards,
Satish -
How to get email alerts ??
Hi all,
I have my work email account in Office 365, I have configured the account in my iPhone 4 running 7.1.1 & it's working fine.
But i have a problem here, i use outlook at Work & i have created folders & folder rules for different people working in my office the folders have been synced to my iPhone but when i receive a mail from a specific person for whom the folder is created i don't get an alert & if the mail comes directly to my inbox everything works fine.
I have to manually go to the folder & update it for syncing the emails. I am missing some of the important emails which i shouldn't have missed.
Please, some body from the forum help me with this.
Thanks,
Pranay.ChrisJ4203 wrote:
You should have the option to Push other mailboxes for your account, which should then provide you with notice. If not notice, at least it will sync those folders without your needing to manually refresh them.
Go into Setting>Mail, Contacts, Calendars and select Fetch New Data. Select the account you want to Push. From there, you should get a selection box for you to chose which folders you want pushed. Try that to see if this improves your experience.
Chris this wouldn't work for a subfolder right? -
How to get an alert when user login with "DDIC" in any of the systems?
Hi all,
Can it be possible when ever the user login with DDIC user in any of the satellite system,can we we get an alert -as DDIC login attempt in any system?
Is this possiblem in CCMS or BPM or...?
Regards,
NeniHi Srikrishna,
Link which you have give is good.But when i login with DDIC i am not geting alerts and i am not able to add any satllites system to
under Security node
My configuration:
Miximum values for list 1 min
When should an alert be triggered?
From value Red Severity 2
Max. number of alerts for each message ID 50
Max. number of lines to be saved 50
SM19
Client * Events
User DDIC selected -Dailog logon Alll
systmem
Please help me.
Regards,
Swaroop -
How to get these substrings based on the string entered
Hi friends
i want the substring entered in the string
the string is something like this: 1234,3653,7684,3254,8777,987,234
now i want
the substrings between commas
can some one help me with it pls
in the first substring i need 1234
in the second i need 3653...
so on till the end..
what ever the string be until the last one
pls helpHi,
You can do something like this:
SELECT txt
, REGEXP_SUBSTR (txt, '[^,]+', 1, 1) AS part_1
, REGEXP_SUBSTR (txt, '[^,]+', 1, 2) AS part_2
, REGEXP_SUBSTR (txt, '[^,]+', 1, 3) AS part_3
FROM table_x
;If there are fewer than n parts, then the technique above will not raise an error; it will just return NULL for part_n.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
Explain how you get those results from that data.
What do you want if the input is like this"
{code}
'foo,,bar'
{code}
? Do you want to consider this as 2 parts ('bar' is the 2nd) or a s 3 (the 2nd is NULL, and 'bar' is the 3rd)? Include examples in your sample data and results.
Always say what version of Oracle you're using. -
How to get previous values based on date filters
Hi
i have two fields gldate and startdate
gldate values are like 1/31/2011,2/28/2011,3/31/2011,4/30/2011,5/31/2011 ...
startdate values 1/1/2011,2/1/2011,3/1/2011,4/1/2011,5/1/2011 ...
i need a condition like gldate<startdate
if startdate is 11/1/2011 then i get all the values before 11/1/2011 values
im using filter for date filed
let us filter values is startdate--11/1/2011 and gldate is 11/30/2011 but that cond falls
how to get this condition
plz its urgent to meHi
i have two fields gldate and startdate
gldate values are like 1/31/2011,2/28/2011,3/31/2011,4/30/2011,5/31/2011 ...
startdate values 1/1/2011,2/1/2011,3/1/2011,4/1/2011,5/1/2011 ...
i need a condition like gldate<startdate
if startdate is 11/1/2011 then i get all the values before 11/1/2011 values
im using filter for date filed
let us filter values is startdate--11/1/2011 and gldate is 11/30/2011 but that cond falls
how to get this condition
plz its urgent to me -
How to get an alert when I file does not exisit in CC
Greetings,
I have a FILE SYSTEM (NFS) communication channel which should read a file from a drive and do content conversion. If the file exists, the process will be completed just fine. However, if no file found, no errors will appear, and the log will show:
11/13/07 10:06:19 AM Polling interval started. Length: 60000.0 seconds
11/13/07 10:06:19 AM Processing finished successfully
11/13/07 10:06:19 AM Processing started
Is there a way to raise an exception or setup an alert in case my communication channel didn't find the file?
Thank youHi,
If u dont have any file in the source directory then how can u see the sucess message in the RWB.When u have to triger an Alert if u have any error.How u declear the Alert catagory.all depends on trigerring an Alert.
If u dont have any file then u ahve to trigger an Alert i dont think any client will require this reqiurement.
if the source directory is wrong or if u have any probelm with mapping or if ur adapter fails then alos u can triiger Alert.
U cant find this type thread in SDN tooo.
Regards,
Phani -
How to get rid of ROWID in Join query -- ORA-00918: column ambiguously defined
Hi, All
the source of my data block is from two tables Emp and Title. My select statements is:
select a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
But at run time, I got "ORA-00918: column ambiguously defined"
the wrapped statement becomes:
SELECT ROWID,a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
I run the query in SQL*PLUS, found out it was ROWID caused problem.
Can anybody tell me how to get rid of ROWID? or I missed something in datablock defination?
Thanks in adance.
DeborahI guess you are using oracle 7.x. In Oracle 8 and onwards, database lets you select ROWID from the views based on multiple views as long as view definition does not contain any aggregated functions or DISTINCT in it. Now coming back to forms ..Forms runtime engine uses ROWID to identify rows uniquely unless specified otherwise. If you are using forms 4.5/5.0 against Oracle 7.x , then change these properties and you should be able to run the form.
BLOCK PROPERTY
Key Mode : can be either updateable OR Non-updateable
( Certainly not 'Unique' .. That forces forms runtime engine to use ROWID to identify unique rows. )
ITEM PROPERTY
Identify one of the block items as unique. And then set the following property
Primary Key : True.
This should take care of rowid problem.
Regards,
Murali.
Hi, All
the source of my data block is from two tables Emp and Title. My select statements is:
select a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
But at run time, I got "ORA-00918: column ambiguously defined"
the wrapped statement becomes:
SELECT ROWID,a.name, b.title, b.start_date, b.end_date from Emp a, Title b where a.id = b.emp_id
I run the query in SQL*PLUS, found out it was ROWID caused problem.
Can anybody tell me how to get rid of ROWID? or I missed something in datablock defination?
Thanks in adance.
Deborah -
10G-form: How to open 2nd form based on the queried result in 1st form?
Form1: text_item1, search_result_text_item11, search_button, go_button
Form2: text_item2
When I press search_button on Form1, I am able to get the result in search_result_text_item11 based on the query defined in the search_button TRIGGER.
So I've value in search_result_text_item11.
Now I want to copy search_result_text_item11 value of Form1 to text_item2 value in Form2 when I click go_button;
How do I do it?
Thanks.
Gauravi can think of two ways,
one is pass it as parameter, when you are calling the new form
or
in form1, in the when-button-pressed trigger of your go_button, copy the value of search_result_text_item11 to a global variable...
in form2, in when-new-form instance, assign the value of the global variable to text_item2
just be sure to erase the global variable immediately after you assigned to text_item2. also, you may want to put, default_value before assigning the global variable to the text_item2, this is to ensure that you will not have error when the global variable is not created. -
How to get the role name in which query is published ?
Hi Experts,
Is there any table where i can get the name of the role in which a particular query is published. I know that if i have a role , i can check in pfcg giving that role name and in menu tab i can see all the queries published under that role. But if i know query but not role how to get the role name . Is there any table or functon modules or programs to get the information.
Thanks & Regards
Vamsi KiranCheck this table
AGR_HIER
Maybe you are looking for
-
Hi, I have fetch to data from ECC custom table to APO and create data, can anyone let me know the procedure. Thanks in advance
-
ITunes 5 upgrade hosed a lot of audio files
Upgrading to iTunes 5 hosed quite a few files that were working in iTunes 4. Almost all the Griffin radio id's got hosed and a lot of music as well--maybe 1-2% or less but that's still a lot. All these files still exist on my iPod--is there any way t
-
Naming PDF's so the "Portfolio" files are viewed in date order
I'm still learning, but I can't figure out how to label a PDF so that when I create a "Portfolio", the data appears in numerical order. Hundreds of pages of bank statements need to be ordered by year and date for easy retrieval, research, etc. I wou
-
What is it that you do not like in Java 6.0?
Anyone doesn't like something in J2SE6.0? Personally I feel that this version of Java was more on integrating Java with other tools and technologies then improving elements in the language. I could be wrong however since I still did not try the 6.0 o
-
Hi Gurus, When the user goes to the punchout site and try to create a shopping cart from the vendor's website, he sees the other user shopping list also.But the user has to see his own shopping list, not any other user shopping list in the vendor's w