Bill Crawley
May 21st, 2009, 09:01 AM
Hi all,
I have declared a temp table in a Stored Proc of the form:
Declare @temp table ([user_id] char(3), prod_id numeric(15,0), version char(1), impression smallint, department char(13), sap_code char(7), ......
I now have a select statement where I want to put all the values obtained into the @temp table. How do I do that. I thought I could get away with:
select......
INTO @temp
where......
When the select statement outputs in the format of the @temp table. but SQL doesn't like it.
I then thought I could get away with
Insert into @temp Values (select.......)
But it still complained. I'm using SQLServer 2005. I need to get the stuff into a temp table so that I can do more on it later in the SP. I'm trying to avoid using a cursor.
Thanks
I have declared a temp table in a Stored Proc of the form:
Declare @temp table ([user_id] char(3), prod_id numeric(15,0), version char(1), impression smallint, department char(13), sap_code char(7), ......
I now have a select statement where I want to put all the values obtained into the @temp table. How do I do that. I thought I could get away with:
select......
INTO @temp
where......
When the select statement outputs in the format of the @temp table. but SQL doesn't like it.
I then thought I could get away with
Insert into @temp Values (select.......)
But it still complained. I'm using SQLServer 2005. I need to get the stuff into a temp table so that I can do more on it later in the SP. I'm trying to avoid using a cursor.
Thanks