Вернуться к статье

Листинг 1. Конвертирование данных из sysindexes

SELECT 	CONVERT (VARCHAR (3), name) ?Name?, id, indid, 
CONVERT (VARCHAR (2), (CONVERT (INT, SUBSTRING (first, 6, 1)) * POWER (2, 8)) + (CONVERT (INT, SUBSTRING (first, 5, 1)))) + ?:? +
CONVERT (VARCHAR (11), 
(CONVERT (INT, SUBSTRING (first, 4, 1)) * POWER (2, 24)) + 
(CONVERT (INT, SUBSTRING (first, 3, 1)) * POWER (2, 16)) + 
(CONVERT (INT, SUBSTRING (first, 2, 1)) * POWER (2, 8)) + 
(CONVERT (INT, SUBSTRING (first, 1, 1)))) ?First converted?,
first,
CONVERT (VARCHAR (2), (CONVERT (INT, SUBSTRING (root, 6, 1)) * POWER (2, 8)) + (CONVERT (INT, SUBSTRING (root, 5, 1)))) + ?:? +
CONVERT (VARCHAR (11), 
(CONVERT (INT, SUBSTRING (root, 4, 1)) * POWER (2, 24)) + 
(CONVERT (INT, SUBSTRING (root, 3, 1)) * POWER (2, 16)) + 
(CONVERT (INT, SUBSTRING (root, 2, 1)) * POWER (2, 8)) + 
(CONVERT (INT, SUBSTRING (root, 1, 1)))) ?Root converted?,
root,
CONVERT (VARCHAR (2), (CONVERT (INT, SUBSTRING (firstIAM, 6, 1)) * POWER (2, 8)) + (CONVERT (INT, SUBSTRING (firstIAM, 5, 1)))) + ?:? +
CONVERT (VARCHAR (11), 
(CONVERT (INT, SUBSTRING (firstIAM, 4, 1)) * POWER (2, 24)) + 
(CONVERT (INT, SUBSTRING (firstIAM, 3, 1)) * POWER (2, 16)) + 
(CONVERT (INT, SUBSTRING (firstIAM, 2, 1)) * POWER (2, 8)) + 
(CONVERT (INT, SUBSTRING (firstIAM, 1, 1)))) ? FirstIAM converted ?,
firstIAM, dpages, used
FROM sysindexes WHERE NAME LIKE ?TA%?

Листинг 2

INSERT INTO TA1 (COL_1) VALUES (?2?)
SELECT
CONVERT (VARCHAR (2), (CONVERT (INT, SUBSTRING (root, 6, 1)) * POWER (2, 8)) + (CONVERT (INT, SUBSTRING (root, 5, 1)))) + ?:? +
CONVERT (VARCHAR (11), 
(CONVERT (INT, SUBSTRING (root, 4, 1)) * POWER (2, 24)) + 
(CONVERT (INT, SUBSTRING (root, 3, 1)) * POWER (2, 16)) + 
(CONVERT (INT, SUBSTRING (root, 2, 1)) * POWER (2, 8)) + 
(CONVERT (INT, SUBSTRING (root, 1, 1)))) ?Root converted?,
root
FROM SYSINDEXES WHERE NAME = ?TA1?


Вернуться к статье