January 6, 2005 at 1:55 pm
I have one porcedure with collect data about all gage which are due for calibration. I would like to use xp_Mial procedure and i would like to send all these data to people every week. On procedue i created globale table which carry all data and i would like to send that whole table by using sql mail. Can i do that. Here is my procedure. It is giving me error message that 50 rows affected but @query has wrong parameter. Need help..
CREATE PROCEDURE [dbo].[GageDueListing]
@Starting_Date smalldatetime = Null,
@Ending_Date smalldatetime = Null
AS
DECLARE @MessageAll NVarchar(255)
--drop table ##DueListing
Create Table ##DueListing
(
Next_Due_Date Smalldatetime,
Gage_ID Varchar(50),
Gage_SN Varchar(50),
Descriptions Varchar(50),
Current_Location Varchar(50),
Calibration_Freq Varchar(10),
Calibration_Time Varchar(20)
)
Insert ##DueListing
(Next_Due_Date,
Gage_ID,
Gage_SN,
Descriptions,
Current_Location,
Calibration_Freq,
Calibration_Time
)
SELECT Next_Due_Date, Gage_ID, Gage_SN, Description, Current_Location, Calibration_Frequency , Calibration_Frequency_UOM
FROM Gage_Master
WHERE Status = 1 And Next_Due_Date >= @Starting_Date AND Next_Due_Date <= @Ending_Date
Order by
Next_Due_Date
Set @MessageAll = '#DueListing'
Exec master..xp_sendmail 'dpatel',
@MessageAll,
@qyery = 'Select * from ##DueListing',
@Subject = 'Gage Due Listing'
Drop table ##DueListing
GO
January 7, 2005 at 8:35 am
Hi,
did you copy the SQL from stored procedure? If so, then probably the problem is here:
@qyery = 'Select * from ##DueListing',
Just a typo... qyery instead of query. Hope this helps... if not, we will try some other way
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply