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 |
|
Billkamm
Posting Yak Master
124 Posts |
Posted - 2006-01-27 : 11:35:45
|
Kristen gave me some sample code in the following thread:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=60825&whichpage=1CODE:UPDATE DSET [MyColumn1] = S.[MyColumn1], [MyStringColumn2] = S.[MyStringColumn2], ...FROM dbo.MyDestinationTable AS D JOIN dbo.MySourceTable AS S ON D.[MyPKColumn] = S.[MyPKColumn]WHERE ( (D.[MyColumn1] <> S.[MyColumn1] OR (D.[MyColumn1] IS NULL AND S.[MyColumn1] IS NOT NULL) OR (D.[MyColumn1] IS NOT NULL AND S.[MyColumn1] IS NULL)) OR (D.[MyStringColumn2] COLLATE Latin1_General_BIN <> S.[MyStringColumn2] OR (D.[MyStringColumn2] IS NULL AND S.[MyStringColumn2] IS NOT NULL) OR (D.[MyStringColumn2] IS NOT NULL AND S.[MyStringColumn2] IS NULL)) ) My questino is why is she using COLLATE? If the tables has an identical structure do you still need to collate? Maybe I'm just confused as to the use of COLLATE. Can anyone help me out please? Thanks. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-01-27 : 13:36:05
|
| Kristen is a he. He probably needed it due to different collations between the joined tables. If your collations are the same, then you can remove that part.Tara Kizeraka tduggan |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-01-28 : 02:44:14
|
| Actually I'm doing it to be fussy about different capitalisation because my server is set to Case insensitive but on my update I want to make sure that any difference triggers an update.But it would take care of different collations too, as you said Tara.Kristen |
 |
|
|
|
|
|