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
 General SQL Server Forums
 New to SQL Server Programming
 Insert using select & one other variable

Author  Topic 

steveowen81
Starting Member

1 Post

Posted - 2009-09-04 : 08:13:17
Hi guys hope some one can help, this is rataling my brain a bit.

Problem:

Have two tables

one call pp_tbl with a field pp_id and a table called feedback_tbl with two fields.

I want to populate the feedback_tbl as follows,
Coloumn 1 (fb_id) this is the identy field
coloum 2 (pp_id) = pp_id (all records from table pp_tbl)
coloum 3 (rl_id) = @rl_id (I send this value by a parameter.


This is where I have got to

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[update_pp_id_rl_id]
@rl_id int
AS

BEGIN

SET NOCOUNT ON;

INSERT cfr_iisuser.pp_feedback_tbl(pp_id, rl_id)
SELECT pp_id FROM cfr_iisuser.promopool_tbl,@RL_id
END


I just does not work though, any help would be great...

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-09-04 : 08:17:24
INSERT cfr_iisuser.pp_feedback_tbl(pp_id, rl_id)
SELECT pp_id,@RL_id FROM cfr_iisuser.promopool_tbl

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page
   

- Advertisement -