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 |
|
asdoye111
Starting Member
16 Posts |
Posted - 2009-06-29 : 13:08:16
|
| i have a quick question.Select I.ACode, I.ADescription + '/' + I.BCode + '-' + I.BDescription + '/' as AString,I.CCode + '-' + I.CDescription + '/' + I.DCode + '-' + I.DDescription + '/' + I.ECode + '-' + I.EDescription as BString,I.FID as CStringFrom table_01 IThis will display a table with something similar to this, minus the * which i have added here(my question on how to display those is below):ACode| AString_ | BString | CString1111 | x-XX/x-XX|aaaaaaaa | ABC*1111 | x-XX/x-XX|BBBBBBBB*| DEF*1111 | x-XX/x-XX|BBBBBBBB*| GHI*1112 | y-YY/y-YY|aaaaaaaa | JKL*1113 | z-ZZ/z-ZZ|aaaaaaaa | MNO*1113 | z-ZZ/z-ZZ|aaaaaaaa | PQR*In the example above, i have put a * next to the items imported into our table that are "NEW". I don't know how to do this in code though. If i do a union and compare the table i'm importing and the full history table and the BString & CString are new items...how do i mark them as new as i want to do above? Also is there a way to take those rows that are marked and put them in a new column showing the new parts?any help would be appreciated!!! |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2009-06-29 : 13:20:55
|
| There are seveal ways.. LEFT OUTER JOIN, NOT EXISTS, OUTER APPLY, etc.. Without knowing your environment, I'd suggest you look up LEFT OUTER JOIN and see if you can make that work. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-29 : 13:43:48
|
| so you want to compare based on values of both BString & CString ? why some of them has * for both field values and some has * only for one of them? |
 |
|
|
asdoye111
Starting Member
16 Posts |
Posted - 2009-06-29 : 14:07:11
|
| First i want to look at Acode, if that is new compared to the history table then it is NEW and i'd put a *.Then i'll move to Astring and do the same comparison.above we'll say that Acode & Astring have been used before in History, but the new Bstrings and Cstrings are marked with *'s.Make sense? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-30 : 13:38:51
|
| not much...so even if there's an occurance of ACode but with other values for other fields, then it wont be new? |
 |
|
|
|
|
|
|
|