Changetable is bult-in SQL functionality for a db which has change tracking enabled.
Object_ID uses a specific syntax - database_name . schema_name . object_name
your example omits the schema name so using 2 . in a row is correct in this case.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Expert,
unable to understand the below query can someone explain me what is happening in below query
CREATE PROCEDURE [dbo].[THINKNEW] @CurrentVersion BIGINT, @LastVersion BIGINT
AS
BEGIN
IF OBJECT_ID(N'tempdb..##RETHINK_temp') IS NOT NULL ------??
BEGIN
DROP TABLE #RETHINK_temp
END
select
RETHINK.NO,
RETHINK.START_DATE,
RETHINK.SourceSystemName
INTO #RETHINK_temp
From RETHINK as RETHINK
RIGHT OUTER JOIN CHANGETABLE (CHANGES RETHINK,
@LastVersion) -----------unable to understand this
as CT on
RETHINK.NO=CT.NO
AND RETHINK.START_DATE=CT.START_DATE
AND RETHINK.SourceSystemName=CT.SourceSystemName
where CT.SYS_CHANGE_VERSION <=
@CurrentVersion
and RETHINK.Isdeleted='Y'
DELETE RETHINK
FROM RETHINK RETHINK
INNER JOIN #RETHINK_temp RETHINK_temp
ON
RETHINK.NO=RETHINK_temp.NO
AND RETHINK.START_DATE=RETHINK_temp.START_DATE
AND RETHINK.SourceSystemName=RETHINK_temp.SourceSystemName
and RETHINK.Isdeleted='Y'
END
GO
query:
1)the changetable is not any table then what is mentioned below
RIGHT OUTER JOIN CHANGETABLE (CHANGES RETHINK, @LastVersion) -----------unable to understand this
what does this below query means and two dots are saying
IF OBJECT_ID(N'tempdb..##RETHINK_temp') IS NOT NULL
Changetable is bult-in SQL functionality for a db which has change tracking enabled.
Object_ID uses a specific syntax - database_name . schema_name . object_name
your example omits the schema name so using 2 . in a row is correct in this case.