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 May 18th, 2004, 12:28 AM
zobernjik zobernjik is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Australia
Posts: 139 zobernjik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 31 m 10 sec
Reputation Power: 5
Arrow Stored Procedure Help??

Hi guys,this is what I have created so far for my procedure that is suppose to email data to a person on every 7th of the month.

The syntax seems to be correct,so on the 7th it is running this query and then I need to create an excel file and email that as an attachment to a person.
Could somebody have a look and help me please.How can I get the procedure to collect the data and create an excel file and email it????

CREATE PROCEDURE GetData AS
DECLARE @RecipientID int
DECLARE @SentToEmail varchar(50)
DECLARE @returnDay int


--Looking at current date,
SELECT @returnDay = DatePart(day,GetDate())
If @returnDay = 7


SELECT a.HospitalName,a.HospitalCode,c.ProductName,b.Unit sDiscarded,b.DateEntered,b.DateCompleted,b.Compile dBy
FROM Units b
inner join Hospitals a ON (a.HospitalID = b.HospitalID)
inner join Products c ON (b.ProductID = c.ProductID) order by a.HospitalID
GO

Reply With Quote
  #2  
Old June 2nd, 2004, 05:24 PM
code-kitty code-kitty is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 10 code-kitty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
These links may help:
Exporting to EXCEL: http://www.mssqlcity.com/Scripts/scrImpExp.htm
Emailing in MS SQL: http://www.pstruh.cz/tips/detpg_sqlemailcdo.htm

Good luck.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Stored Procedure Help??


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 5 hosted by Hostway