Click here to Skip to main content
15,891,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is my normal join condition query

SQL
select C.[Search Name],SA.Name,'',SA.Address,SA.[Address 2],'','','',
SA.[Post Code]<pre lang="SQL"> from dbo.[CRONUS International Ltd_$Customer] C with (nolock)
inner join dbo.[CRONUS International Ltd_$Ship-to Address] SA with (nolock)
on  C.No_=SA.[Customer No_]


Here I Getting result ..If I update above two tables

Then I try this query using "CHANGETABLE"

SQL
select C.[Search Name],SA.Name,'',SA.Address,SA.[Address 2],'','','',
SA.[Post Code],CT. [SYS_CHANGE_VERSION],CT.[SYS_CHANGE_CREATION_VERSION],
CT.[SYS_CHANGE_OPERATION],CT.[SYS_CHANGE_COLUMNS],CT.[SYS_CHANGE_CONTEXT]
From  CHANGETABLE(CHANGES dbo.[CRONUS International Ltd_$Customer], 
1) AS CT inner join dbo.[CRONUS International Ltd_$Customer] C
with (nolock) on ct. No_=c.No_ INNER JOIN  dbo.[CRONUS International   
Ltd_$Ship-to Address] SA 
with (nolock) on C.No_=SA.[Customer No_] inner join
CHANGETABLE(CHANGES dbo.[CRONUS International Ltd_$Ship-to Address], 
1) AS CP on CP.[Customer No_]=SA.[Customer No_]  WHERE 1=1  


Here I am not getting any result from this query..

How can I getting the result using changetable condition using condition

Please help me..
Posted
Updated 11-Jun-15 20:51pm
v3
Comments
Abhipal Singh 12-Jun-15 4:25am    
Without sample data.. We cannot figure out what is wrong in the query..

1 solution

silly question, is change tracking enabled?

https://msdn.microsoft.com/en-us/library/bb964713.aspx[^]

you just seem to be using a value of 1 for the last_sync_version, rather than getting the change tracking current version...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900