-- Licensed Materials - Property of IBM
--
-- BI and PM: CM
--
-- (C) Copyright IBM Corp. 2008, 2009
--
-- US Government Users Restricted Rights - Use, duplication or disclosure
-- restricted by GSA ADP Schedule Contract with IBM Corp.

-- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
-- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).


CREATE PROCEDURE CMPARSECOPYIDS @QUERYID int, @GROUPID int, @SOURCEIDS image, @TARGETIDS image AS
SET NOCOUNT ON
DECLARE @SOURCEIMAGESIZE AS int
DECLARE @CURPOS AS int
SELECT @CURPOS=0
SELECT @SOURCEIMAGESIZE = DATALENGTH(@SOURCEIDS)
WHILE @CURPOS < @SOURCEIMAGESIZE
BEGIN
	INSERT INTO #CMTMPCOPYIDS (QUERYID,GROUPID,SOURCECMID, TARGETCMID) SELECT @QUERYID, @GROUPID,  CAST(SUBSTRING(@SOURCEIDS, @CURPOS+1, 4) AS int), CAST(SUBSTRING(@TARGETIDS, @CURPOS+1, 4) AS int)
	SELECT @CURPOS=@CURPOS+4
END
