dbTalk Databases Forums  

adding extra query in the Transform Data task

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss adding extra query in the Transform Data task in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Owen
 
Posts: n/a

Default adding extra query in the Transform Data task - 11-16-2005 , 07:23 PM






Hello:

I have 3 table with this description:

Table1
--------
id: int
value1: int

Table2
--------
id: int
value1: int
title as varchar(80)

Table3
--------
id: int
norden: int
text : varchar


I have to transform data from Table1 to Table2 but get some value from
Table3 too, I explain what I want specific.
in Table3 I have for every id about 24 text, and id of each text is norden,
then I have to get from Table1 id and value1, to import in id and value1 to
Table2, but then get the first text in Table3 for current id in progress
that have more than 40 character, how can I do that.

Thanks for advantage,
Best regards,
Owen.



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: adding extra query in the Transform Data task - 11-17-2005 , 12:18 AM






If they all are in the same DB on the same server then you should do
this in the SQL Statement you use as the source for your datapump.

Allan

"Owen" <anibal (AT) prensa-latina (DOT) cu> wrote


Quote:
Hello:

I have 3 table with this description:

Table1
--------
id: int
value1: int

Table2
--------
id: int
value1: int
title as varchar(80)

Table3
--------
id: int
norden: int
text : varchar


I have to transform data from Table1 to Table2 but get some value from
Table3 too, I explain what I want specific.
in Table3 I have for every id about 24 text, and id of each text is
norden,
then I have to get from Table1 id and value1, to import in id and value1
to
Table2, but then get the first text in Table3 for current id in progress
that have more than 40 character, how can I do that.

Thanks for advantage,
Best regards,
Owen.


Reply With Quote
  #3  
Old   
owen
 
Posts: n/a

Default Re: adding extra query in the Transform Data task - 11-17-2005 , 10:37 AM



Please can you explain me yout idea step by step, because I'm a begginer in
DTS please.

Best regards,
Owen.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
If they all are in the same DB on the same server then you should do
this in the SQL Statement you use as the source for your datapump.

Allan

"Owen" <anibal (AT) prensa-latina (DOT) cu> wrote in message
news:OGVAn0w6FHA.2600 (AT) tk2msftngp13 (DOT) phx.gbl:

Hello:

I have 3 table with this description:

Table1
--------
id: int
value1: int

Table2
--------
id: int
value1: int
title as varchar(80)

Table3
--------
id: int
norden: int
text : varchar


I have to transform data from Table1 to Table2 but get some value from
Table3 too, I explain what I want specific.
in Table3 I have for every id about 24 text, and id of each text is
norden,
then I have to get from Table1 id and value1, to import in id and value1
to
Table2, but then get the first text in Table3 for current id in progress
that have more than 40 character, how can I do that.

Thanks for advantage,
Best regards,
Owen.




Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: adding extra query in the Transform Data task - 11-17-2005 , 04:11 PM



You want something very simialr to

This does not really have a lot to do with DTS per se as this could be
done without it. You want something very similar to

(PS you do not tell is if these tables are in the same DB or even on the
same server)

INSERT TABLE2(Column List)
SELECT (Columns)
FROM TABLE2 T2 JOIN TABLE3 T3
ON T2.ID = T3.ID


Allan


"owen" <anibal (AT) prensa-latina (DOT) cu> wrote


Quote:
Please can you explain me yout idea step by step, because I'm a begginer
in
DTS please.

Best regards,
Owen.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eXL0o6z6FHA.3544 (AT) TK2MSFTNGP09 (DOT) phx.gbl...

If they all are in the same DB on the same server then you should do
this in the SQL Statement you use as the source for your datapump.

Allan

"Owen" <anibal (AT) prensa-latina (DOT) cu> wrote in message
news:OGVAn0w6FHA.2600 (AT) tk2msftngp13 (DOT) phx.gbl:


Hello:

I have 3 table with this description:

Table1
--------
id: int
value1: int

Table2
--------
id: int
value1: int
title as varchar(80)

Table3
--------
id: int
norden: int
text : varchar


I have to transform data from Table1 to Table2 but get some value
from
Table3 too, I explain what I want specific.
in Table3 I have for every id about 24 text, and id of each text is
norden,
then I have to get from Table1 id and value1, to import in id and
value1
to
Table2, but then get the first text in Table3 for current id in
progress
that have more than 40 character, how can I do that.

Thanks for advantage,
Best regards,
Owen.




Reply With Quote
  #5  
Old   
owen
 
Posts: n/a

Default Re: adding extra query in the Transform Data task - 11-18-2005 , 07:48 PM



I appreciate your answer to my questions, but let me ask other about the
same problem, I make query like you teach me but I get some row duplicate,
how I can remove this duplicate row

remember that in table 3 for one id have a lot of norden, I make this
query:

select *
from table1 inner join table3 on (table1.id = table3.id)
where len(table3.text) > 50
order by norden //to get the first row that get this goal, because I want to
get the first order by norden

then I want to elimate the duplicate id that return this query, can you help
again please.

Best regards,
Owen.


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
You want something very simialr to

This does not really have a lot to do with DTS per se as this could be
done without it. You want something very similar to

(PS you do not tell is if these tables are in the same DB or even on the
same server)

INSERT TABLE2(Column List)
SELECT (Columns)
FROM TABLE2 T2 JOIN TABLE3 T3
ON T2.ID = T3.ID


Allan


"owen" <anibal (AT) prensa-latina (DOT) cu> wrote in message
news:OrH#3w46FHA.3136 (AT) TK2MSFTNGP09 (DOT) phx.gbl:

Please can you explain me yout idea step by step, because I'm a begginer
in
DTS please.

Best regards,
Owen.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eXL0o6z6FHA.3544 (AT) TK2MSFTNGP09 (DOT) phx.gbl...

If they all are in the same DB on the same server then you should do
this in the SQL Statement you use as the source for your datapump.

Allan

"Owen" <anibal (AT) prensa-latina (DOT) cu> wrote in message
news:OGVAn0w6FHA.2600 (AT) tk2msftngp13 (DOT) phx.gbl:


Hello:

I have 3 table with this description:

Table1
--------
id: int
value1: int

Table2
--------
id: int
value1: int
title as varchar(80)

Table3
--------
id: int
norden: int
text : varchar


I have to transform data from Table1 to Table2 but get some value
from
Table3 too, I explain what I want specific.
in Table3 I have for every id about 24 text, and id of each text is
norden,
then I have to get from Table1 id and value1, to import in id and
value1
to
Table2, but then get the first text in Table3 for current id in
progress
that have more than 40 character, how can I do that.

Thanks for advantage,
Best regards,
Owen.






Reply With Quote
  #6  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: adding extra query in the Transform Data task - 11-19-2005 , 06:20 AM



So by joining onto Table3 you get many rows back for the same id because
table3 has many entries for that id?

You only want to return the one?

Which one?

There must be a reason you join onto Table 3 so what exactly do you want
from there? The latest entry in date? The first alphabetically


Let me give you an example

CREATE TABLE T1(T1PK int primary Key, col2 int)
CREATE TABLE T2(T2PK int primary Key, col2 int, T1PK int references
T1(T1PK))

INSERT T1(T1PK,Col2) VALUES(1,1)
INSERT T2(T2PK,Col2,T1PK) VALUES(1,1,1)
INSERT T2(T2PK,Col2,T1PK) VALUES(2,2,1)
INSERT T1(T1PK,Col2) VALUES(2,1)
INSERT T2(T2PK,Col2,T1PK) VALUES(3,3,2)
INSERT T2(T2PK,Col2,T1PK) VALUES(4,4,2)
INSERT T2(T2PK,Col2,T1PK) VALUES(5,5,2)

--This will return all rows
SELECT
T1.col2,T2.col2
FROM
T1 JOIN T2
ON
T1.T1PK = T2.T1PK

--This will return only one row for each ID based on the MIN(col2) in T2
SELECT
T1.col2,T2.col2
FROM
T1 JOIN T2
ON
T1.T1PK = T2.T1PK
AND
T2.Col2 = (SELECT MIN(col2) FROM T2 WHERE T1PK = T1.T1PK)


Allan


"owen" <anibal (AT) prensa-latina (DOT) cu> wrote


Quote:
I appreciate your answer to my questions, but let me ask other about the
same problem, I make query like you teach me but I get some row
duplicate,
how I can remove this duplicate row

remember that in table 3 for one id have a lot of norden, I make this
query:

select *
from table1 inner join table3 on (table1.id = table3.id)
where len(table3.text) > 50
order by norden //to get the first row that get this goal, because I
want to
get the first order by norden

then I want to elimate the duplicate id that return this query, can you
help
again please.

Best regards,
Owen.


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:uO1QKP86FHA.2576 (AT) TK2MSFTNGP09 (DOT) phx.gbl...

You want something very simialr to

This does not really have a lot to do with DTS per se as this could be
done without it. You want something very similar to

(PS you do not tell is if these tables are in the same DB or even on
the
same server)

INSERT TABLE2(Column List)
SELECT (Columns)
FROM TABLE2 T2 JOIN TABLE3 T3
ON T2.ID = T3.ID


Allan


"owen" <anibal (AT) prensa-latina (DOT) cu> wrote in message
news:OrH#3w46FHA.3136 (AT) TK2MSFTNGP09 (DOT) phx.gbl:


Please can you explain me yout idea step by step, because I'm a
begginer
in
DTS please.

Best regards,
Owen.

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote in message
news:eXL0o6z6FHA.3544 (AT) TK2MSFTNGP09 (DOT) phx.gbl...


If they all are in the same DB on the same server then you should
do
this in the SQL Statement you use as the source for your datapump.

Allan

"Owen" <anibal (AT) prensa-latina (DOT) cu> wrote in message
news:OGVAn0w6FHA.2600 (AT) tk2msftngp13 (DOT) phx.gbl:



Hello:

I have 3 table with this description:

Table1
--------
id: int
value1: int

Table2
--------
id: int
value1: int
title as varchar(80)

Table3
--------
id: int
norden: int
text : varchar


I have to transform data from Table1 to Table2 but get some
value

from

Table3 too, I explain what I want specific.
in Table3 I have for every id about 24 text, and id of each text
is
norden,
then I have to get from Table1 id and value1, to import in id
and

value1

to
Table2, but then get the first text in Table3 for current id in

progress

that have more than 40 character, how can I do that.

Thanks for advantage,
Best regards,
Owen.






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.