Skip to end of banner
Go to start of banner

Insert Rank Name to Rank Code Xref (Crewlink Interface)

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 2 Next »

Summary

The script can be used to insert Rank Name to Rank Code Xref

Keywords

Xref, Rank, Crewlink

Category

SQL Statement

Please remember to add labels to the article. Only the labels from the lit are allowed: /wiki/spaces/PnP/pages/4523197124

Description

The script can be used to insert Rank Name to Rank Code Xref. The script is designed to be used for Crewlink Interface but can be modified for other interface codes.

Selection

The script takes the Rank name and inserts it in the Xref field of the Rank Codes where Interface Code=”CREWLINK”:

SQL statement

 Click here to expand...
declare @Code varchar(10) = (select MIN(CODE) from PW001C02);
while @Code is not null
begin
	print @Code;
	if (select CODE from PW001C000_XREF
		where INTERFACE_XREF='CREWLINK' and TABLE_REF=2 and CODE=@Code) is not null
		begin
			update PW001C000_XREF
			set XREF_CODE = (select [NAME] from PW001C02 where CODE = @Code)
			where CODE = @Code;
		end
	else
		begin
			insert into PW001C000_XREF (INTERFACE_XREF,TABLE_REF,CODE,XREF_CODE,COMMENT,repl_ModifiedBySite,repl_ModifiedDate,REPL_GMTMODIFIEDDATE)
			values ('CREWLINK',2,@Code,(select [NAME] from PW001C02 where CODE = @Code),'',(select sitenr from repl_Site where isCurrentSite=1),getdate(),GETUTCDATE());
		end
	set @Code = (select MIN(CODE) from PW001C02 where CODE > @Code);
end;
go

Field Specification

N/A

  • No labels