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.
| Author |
Topic |
|
chandrugbhatia
Starting Member
6 Posts |
Posted - 2004-06-14 : 19:27:03
|
| Here is the scenario. I have to match 2 different fields in two different tables. How do i do this in SQL please. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-06-14 : 19:31:00
|
| select *from tbl1join tbl2on tbl1.fld1 = tbl2.fld2What exactly do you want to do?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
chandrugbhatia
Starting Member
6 Posts |
Posted - 2004-06-14 : 19:45:51
|
| Hey .. thanks.. whats happening is we have a source file with raw data in it.. which will go through an ETL (Extract Transform Load) process where it will be validated and transformed in one server. The data has to go into the target field which is in another server. We have to do a field to field validation hence we have to compare source with target and make sure the values are the same. Later i have transformations that i have to do. :( Like for example.. "The default is blank(source), this should be transformed to 'NULL'(Target)". Hence the target field should be NULL. I will have a lot more questions soon. But thanks for the start. If you know how to write the select statement for this one, please help. Thanks once again. |
 |
|
|
chandrugbhatia
Starting Member
6 Posts |
Posted - 2004-06-14 : 19:47:38
|
| Do i write it exactly how it is below? select *from tbl1join tbl2on tbl1.fld1 = tbl2.fld2What exactly do you want to do?==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy.[/quote] |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-06-14 : 20:25:54
|
| Look up CASE. You should build a table that has defaults and validation values to compare. You can then use CASE statements in your original INSERT statement to do both the validation/transformation and the later transformation at the same time. Of course, we're all just guessing without seeing your table structure and some sample data.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
chandrugbhatia
Starting Member
6 Posts |
Posted - 2004-06-14 : 21:39:02
|
| some data i am giving:Source field description type lengthbankcard_trades String 2Target field description type Null optionBKCD_TRDS SMALLINT NULLField source Transformation Target fieldbankcard_trades None BKCD_TRDSsource file: mstr.MMYYtarget file: CR_EFXso can someone confirm if i just the below select statement and submit it. I have never heard 'on'. I don't know so can you please confirm. select *from mstr.MMYYjoin CR_EFXon mstr.MMYY.bankcard_trades = CR_EFX.BKCD_TRDS |
 |
|
|
|
|
|