Re: newbie SP question
From: Miguel Salles (MiguelSalles_at_discussions.microsoft.com)
Date: 12/20/04
- Previous message: Hugo Kornelis: "Re: newbie SP question"
- In reply to: Hugo Kornelis: "Re: newbie SP question"
- Next in thread: Hugo Kornelis: "Re: newbie SP question"
- Reply: Hugo Kornelis: "Re: newbie SP question"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 20 Dec 2004 06:13:04 -0800
Hi Hugo,
Thanks for your help!
Thats what I want to do: I have a staging table were I load all my products
(dbo.product_laam) I want to read the data from it and populate a new table
that has Product_ID as PK (wich Identify a single product).
--I want to insert new data in my product table as:
insert into DATAWAREHOUSE.rsc_dim_product_agg_laam
select T1.product_id
, T1.toy_number
, T1.master_item_description
, T1.product_category_1
, T1.product_category_2
, T1.product_category_3
, T1.product_category_4
, T1.product_category_5
, T1.category_1_description
, T1.category_2_description
, T1.category_3_description
, T1.category_4_description
, T1.category_5_description
, {fn NOW()} --(creation date)
, null
from dbo.product_laam T1
where T1.product_id not in (select product_id from
DATAWAREHOUSE.rsc_dim_product_agg_laam)
--Then I want to update existing data in my table as:
Update DATAWAREHOUSE.rsc_dim_product_agg_laam
set toy_number = T1.toy_number
, master_item_description = T1.master_item_description
, product_category_1 = T1.product_category_1
, product_category_2 = T1.product_category_2
, product_category_3 = T1.product_category_3
, product_category_4 = T1.product_category_4
, product_category_5 = T1.product_category_5
, category_1_description = T1.category_1_description
, category_2_description = T1.category_2_description
, category_3_description = T1.category_3_description
, category_4_description = T1.category_4_description
, category_5_description = T1.category_5_description
, last_update_date = {fn NOW()}
from dbo.product_laam T1
where product_id = T1.product_id
--All in one Stored Procedure
Thanks a lot
miguel@unipl_NO_ace_SPAM_.com.br
"Hugo Kornelis" wrote:
> On Mon, 20 Dec 2004 05:01:01 -0800, Miguel Salles wrote:
>
> (snip)
> >Can anyone please help me?
>
> Hi Miiguel,
>
> Quite probably, but only if you post more information. For starters, we
> need to know your table structure (posted as CREATE TABLE statements,
> excluding irrelevant columns but including all constraints, properties and
> indexes), some sample data (posted as INSERT statements) and expected
> output plus a description of what you're trying to accomplish.
>
> http://www.aspfaq.com/5006
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
- Previous message: Hugo Kornelis: "Re: newbie SP question"
- In reply to: Hugo Kornelis: "Re: newbie SP question"
- Next in thread: Hugo Kornelis: "Re: newbie SP question"
- Reply: Hugo Kornelis: "Re: newbie SP question"
- Messages sorted by: [ date ] [ thread ]