If I remember correctly you would declare the variable declare @AffiliateID int declare @RateCodeID int
Then set them to the value in the query SELECT @AffiliateID = A.AffiliateID, @RateCodeID = dbo.B.RateCodeID Then you just insert those variables VALUES (@AffiliateID ,@RateCodeID ) It has been a while since I have done this so I could be wrong. :) Phillip B. www.LoungeRoyale.com www.FillWorks.com ----- Original Message ----- From: "Bosky, Dave" <[EMAIL PROTECTED]> To: "SQL" <[EMAIL PROTECTED]> Sent: Wednesday, July 02, 2003 9:15 AM Subject: Stored procedure help? > How can I use values returned from one query in another query? > What I want to do is insert values returned from one query into another > table. > I'm still learning how to write T-SQL SP using MS SQL Server 2000. > > SELECT A.AffiliateID, dbo.B.RateCodeID > FROM dbo.tbl_affiliates A > INNER JOIN dbo.tbl_affiliates_ratecodes B ON A.AffiliateID = B.AffiliateID > WHERE (A.ReferringDomain = '@referringdomain') AND (B.RateCode = > '@ratecode') > > SET @verify = @@rowcount > > /* insert an entry into the referrer log if the domain has been verified. */ > IF @verify > 0 > BEGIN > INSERT INTO dbo.tbl_affiliates_log (AffiliateID, RateCodeID) > > VALUES (@??????,@??????) > END > END > > > Thanks, > Dave Bosky > > > > > HTC Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6 Get the mailserver that powers this list at http://www.coolfusion.com
