Rockwell Automation RSBizWare Administration Guide User Manual
Page 300

Appendix D Application notes for FactoryTalk Transaction Manager
INSERT INTO my_next_int_table values (8001,8002,8003,8004,4)
INSERT INTO my_next_int_table values (5001,8002,8003,8004,4)
INSERT INTO my_next_int_table values (4001,8002,8003,8004,4)
INSERT INTO my_next_int_table values (8001,8002,8003,8004,4)
INSERT INTO my_next_int_table values (8001,8002,8003,8004,4)
INSERT INTO my_next_int_table values (3401,8002,8003,8004,4)
INSERT INTO my_next_int_table values (6701,8002,8003,8004,4)
INSERT INTO my_next_int_table values (901,8002,8003,8004,4)
INSERT INTO my_next_int_table values (8001,8002,8003,8004,4)
Following is a sample creation statement containing dummy data:
CREATE PROCEDURE chunk_maker_cursor(@in_number int, @out_binary
VARBINARY(200) OUT)
AS
DECLARE
@val1 INT,
@binary1 VARBINARY(2),
@loop INT
DECLARE int_cursor CURSOR
LOCAL FORWARD_ONLY STATIC READ_ONLY
FOR SELECT int1 FROM my_next_int_table
WHERE record_row = @in_number
ORDER BY int1
BEGIN
--------------------------------------------------------------
--
Note: This procedure only accepts positive integers, some math
must be applied to
-- the upper word of each integer for negative integer values.
--------------------------------------------------------------
--------------------------------------------------------------
-- The following code illustrates how the substring is combined:
--------------------------------------------------------------
-- initialize loop var
SELECT @loop = 1
OPEN int_cursor
FETCH NEXT FROM int_cursor
INTO @val1
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @binary1 = @val1
-- The following code illustrates how the substring is combined
in reverse order for
-- byte swapping. Because the first loop must differ, the following
IF statement is
300
Rockwell Automation Publication BZWARE-IN001M-EN-P-June 2014