i am new to SPs and i need some basic answers
i wrote the below querie which returns a number but i want to store that number in a variable.
i wrote the below querie which returns a number but i want to store that number in a variable.
Code:
CREATE PROCEDURE sp_ac6000_metric_load
AS
SELECT count(diffdays)as counts
FROM (SELECT ID,
Initial_Date,
getdate() AS Today,
DateDiff(day,Initial_Date,getdate()) AS diffDays,
left(Active,1) as active,
left(Railroad,4)as rail ,
left(REMOTE_MON_REC,10) as REC
FROM ac6000_loco_data
WHERE Initial_Date<>'' AND
ac6000_loco_data.Active='Y' AND
ac6000_loco_data.remote_mon_rec<>'' AND
ac6000_loco_data.Railroad='up') as DTA