Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 24th, 2004, 02:14 PM
everwitu everwitu is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 everwitu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to run store procedure then send result to user

hi,
Here is the issue. There are 10 sql servers, server1, server2 ... server10
on each of the server i need to run a query, then send that result to me in email.
What i'd like to do is create a store proc (for that query) then send the result to my email. How do i go about doing that?
Do i need to create a store proc locally on each sql server? and how do I schedule it to run at a specific time, then send the result to my email.

Thanks for your help.

Reply With Quote
  #2  
Old November 24th, 2004, 02:33 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,770 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 7 h 4 m 46 sec
Reputation Power: 469

Reply With Quote
  #3  
Old November 24th, 2004, 02:44 PM
blicci's Avatar
blicci blicci is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Philly
Posts: 351 blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level)blicci User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 22 h 8 m 5 sec
Reputation Power: 52
I would use a dts package.
You can create different connection objects to access your different servers or you can programatically change the datasource through active-X scripting.
As for e-mailing the results.... You can execute your stored proc/query and load the results into a global variable that can be e-mailed as the body of the message, or you can have the results dumped to a file and then attach the file to an e-mail.
DTS Packages can all be scheduled through the Sql Server Agent or through the windows scheduler by executing a batch file.

Reply With Quote
  #4  
Old November 24th, 2004, 03:44 PM
MrData MrData is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Sacramento, California, USA
Posts: 13 MrData User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 11 sec
Reputation Power: 0
What you'll find when you search Google

... will be the instruction to look up this command:

Code:
 
 EXEC master..xp_sendmail @subject = 'subject', etc.
 
 


look through books on-line for SQL server for the details of how to use it, and what permissions you'll need on the sproc to get it to run, along with how you'll need to have an account in your email system for the SQL Server for it to work properly.

Hope this helps,
Steve

Reply With Quote
  #5  
Old November 29th, 2004, 01:18 AM
everwitu everwitu is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 2 everwitu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you very much everyone.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > How to run store procedure then send result to user


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT