Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Procedure - select then insert

Author  Topic 

nhaas
Yak Posting Veteran

90 Posts

Posted - 2009-11-10 : 19:12:45
OK something new for me. I want to give a procedure two variables have a Select statement find 1 information then insert all 3 variables????? Clear as mud

CREATE PROCEDURE MinutesQC
(
@HEADERNUM VARCHAR(50),
@PNumber char(10)
)
AS
SELECT sum(DISTINCT col_10)/60 FROM itemisedCharges WHERE (serve_No = @PNumber and ACC_Header = @HEADERNUM) and Charge_cat='airtime'


INSERT INTO TempQuickcomm (Phonenumber,Header,col_10)values(@PNumber, @HEADERNUM,col_10)
GO

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-11 : 04:19:35
INSERT INTO TempQuickcomm (Phonenumber,Header,col_10)
SELECT
serve_No,
ACC_Header,
sum(DISTINCT col_10)/60
FROM itemisedCharges
WHERE serve_No = @PNumber
and ACC_Header = @HEADERNUM
and Charge_cat='airtime'


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-11-11 : 12:15:05
quote:
Originally posted by webfred

INSERT INTO TempQuickcomm (Phonenumber,Header,col_10)
SELECT
serve_No,
ACC_Header,
sum(DISTINCT col_10)/60
FROM itemisedCharges
WHERE serve_No = @PNumber
and ACC_Header = @HEADERNUM
and Charge_cat='airtime'
GROUP BY serve_No,
ACC_Header


No, you're never too old to Yak'n'Roll if you're too young to die.

Go to Top of Page

nhaas
Yak Posting Veteran

90 Posts

Posted - 2009-11-11 : 21:53:01
Thanks I will try this in the morning!!
Go to Top of Page
   

- Advertisement -