If we want to search the stored procedure name for the text then we can try
Select Distinct SO.Name from sysobjects SO (NOLOCK) INNER JOIN syscomments SC (NOLOCK) on SO.Id=SC.ID and SO.Type = 'P' AND SC.Text LIKE '%%distinct%city from dmslocation%' order by SO.Name
Tuesday, November 24, 2009
Tuesday, November 17, 2009
Automating Birthday Email
1. You can schedule a job at 05:00 AM every day to accompish this, just open Enterprise Manager, explorer MySQLInstance->'Management'->'SQL Server Agent'->right click 'Jobs'->'New Job', then go to 'Steps' pannel to new a step. Choose 'T-SQL' as step type, and copy your T-SQL script used for sending email to the 'Command' field (as you'll schedule the script to run once a day, let's remove the 'WHILE(1=1)' loop). Then go to 'Schedules' pannel to schedule your job step. You can press F1 for detailed help. Sorry I wrote a wrong script in my previous post, for the case that there may be more than 2 persons have same birhday:
declare @email varchar(100), @name varchar(100)
select email,name into #tbl
from tbl_Birthday
where month(birthdate)=month(getdate())
and day(birthdate)=day(getdate())
select @eamil=email,@name='Happy Birthday'+name+'!' from #tbl
WHILE (@email is not null)
BEGIN
EXEC master.dbo.xp_sendmail
@recipients = @email,
@subject = N'Happy Birthday!',
@message = @name,
@attachments='c:\happyBirth.html'--you have use attachment if you want HTML feature
DELETE FROM #tbl where email=@email
select @eamil=email,@name='Happy Birthday'+name+'!' from #tbl
END
DROP TABLE #tbl
------------------------------------
Suggested site:
http://www.howtogeek.com/howto/database/sending-automated-job-email-notifications-in-sql-server-with-smtp/
declare @email varchar(100), @name varchar(100)
select email,name into #tbl
from tbl_Birthday
where month(birthdate)=month(getdate())
and day(birthdate)=day(getdate())
select @eamil=email,@name='Happy Birthday'+name+'!' from #tbl
WHILE (@email is not null)
BEGIN
EXEC master.dbo.xp_sendmail
@recipients = @email,
@subject = N'Happy Birthday!',
@message = @name,
@attachments='c:\happyBirth.html'--you have use attachment if you want HTML feature
DELETE FROM #tbl where email=@email
select @eamil=email,@name='Happy Birthday'+name+'!' from #tbl
END
DROP TABLE #tbl
------------------------------------
Suggested site:
http://www.howtogeek.com/howto/database/sending-automated-job-email-notifications-in-sql-server-with-smtp/
Thursday, November 5, 2009
Disabling Items Of Drop Down List
ListItem i = DropDownList1.Items.FindByValue("Finished");
i.Attributes.Add("style", "color:gray;");
i.Attributes.Add("disabled", "true");
i.Value = "-1";
i.Attributes.Add("style", "color:gray;");
i.Attributes.Add("disabled", "true");
i.Value = "-1";
Wednesday, November 4, 2009
Show Processing on Page using Modal Popup
Write the following code inside form tag and updatepanel.
< script type="text/javascript" language="javascript" >
// register for our events
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);
function beginRequest(sender, args)
{
// show the popup
$find('mdlPopup').show();
// if we are using this fanda in master page then
// $find(' < %=mdlPopup.ClientID% >').show();
}
function endRequest(sender, args)
{
// hide the popup
$find('mdlPopup').hide();
//WindowScroll();
// if we are using this fanda in master page then
// $find(' < %=mdlPopup.ClientID% >').show();
}
< /script >
//////////////////////////
< cc1:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="pnlPopup"
PopupControlID="pnlPopup" BackgroundCssClass="modalBackground" >
< /cc1:ModalPopupExtender >
< asp:Panel ID="pnlPopup" runat="server" CssClass="updateProgress" style="display:none" >
< div align="center" class="ProgressBarCenter" >
< asp:Image ID="img" runat="server" ImageUrl="~/Images/simple.gif" / >
< span class="updateProgressMessage" > Loading ... < /span > < /div >
< /asp:Panel >
< script type="text/javascript" language="javascript" >
// register for our events
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);
function beginRequest(sender, args)
{
// show the popup
$find('mdlPopup').show();
// if we are using this fanda in master page then
// $find(' < %=mdlPopup.ClientID% >').show();
}
function endRequest(sender, args)
{
// hide the popup
$find('mdlPopup').hide();
//WindowScroll();
// if we are using this fanda in master page then
// $find(' < %=mdlPopup.ClientID% >').show();
}
< /script >
//////////////////////////
< cc1:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="pnlPopup"
PopupControlID="pnlPopup" BackgroundCssClass="modalBackground" >
< /cc1:ModalPopupExtender >
< asp:Panel ID="pnlPopup" runat="server" CssClass="updateProgress" style="display:none" >
< div align="center" class="ProgressBarCenter" >
< asp:Image ID="img" runat="server" ImageUrl="~/Images/simple.gif" / >
< span class="updateProgressMessage" > Loading ... < /span > < /div >
< /asp:Panel >
Subscribe to:
Posts (Atom)