I am using ASE 16.0 on a Windows 7 PC.
I have run this SQL to create a source table:
CREATE TABLE dbo.DP2_109_72ba58ce73a3472db8dce74bc54f827b
(
Name_NVARCHAR NVARCHAR (4000) NULL,
RGB INT NULL,
RedComponent_INT INT NULL,
GreenComponent_INT INT NULL,
BlueComponent_INT INT NULL,
RedComponent_DEC DECIMAL (19,11) NULL,
GreenComponent_DEC DECIMAL (19,11) NULL,
BlueComponent_DEC DECIMAL (19,11) NULL,
RedComponent_TINYINT TINYINT NULL,
RedComponent_SMALLINT SMALLINT NULL,
RedComponent_BIGINT BIGINT NULL,
RedComponent_BIT BIT NOT NULL,
Name_VARCHAR VARCHAR (8000) NULL,
Name_CHAR NVARCHAR (4000) NULL,
Name_NCHAR NVARCHAR (4000) NULL,
Name_VARCHARMAX VARCHAR (8000) NULL,
Name_TEXT TEXT NULL,
RedComponent_SMALLMONEY DECIMAL (15,7) NULL,
RedComponent_MONEY DECIMAL (24,7) NULL,
Now_DATETIME DATETIME NULL,
Now_DATETIME2 DATETIME NULL,
Now_SMALLDATETIME DATETIME NULL,
Now_DATE DATETIME NULL
)
LOCK ALLPAGES
ON 'default'
GO
and this to create a target table:
CREATE TABLE dbo.SYB_NUMERICS
(
S_Name_NVARCHAR NVARCHAR (50) null,
S_RGB INT NULL,
S_RedComponent_INT INT NULL,
S_GreenComponent_INT INT NULL,
S_BlueComponent_INT INT NULL,
S_RedComponent_DEC_15_6 decimal(15, 6) NULL,
S_GreenComponent_DEC_18_10 decimal(18, 10) NULL,
--S_BlueComponent_DEC_12_2 decimal(12, 2) NULL, ---affected by truncation
S_RedComponent_TINYINT TINYINT NULL,
S_RedComponent_SMALLINT SMALLINT NULL,
S_RedComponent_BIGINT BIGINT NULL,
S_RedComponent_BIT BIT ,
S_VARCHAR_50 VARCHAR (50),
S_CHAR_50 CHAR (50),
S_NCHAR_50 NCHAR (50),
S_NCHAR_5 NCHAR (5),
S_VARCHARMAX VARCHAR (4000),
S_TEXT TEXT,
RedComponent_SMALLMONEY SMALLMONEY NULL,
RedComponent_MONEY MONEY NULL/*,
RedComponent_FLOAT FLOAT NULL,
RedComponent_REAL REAL NULL*/
)
LOCK ALLPAGES
ON 'default'
GO
And I am running this SQL to populate the target from the source:
SET QUOTED_IDENTIFIER ON
INSERT "dbo"."SYB_NUMERICS" ("S_Name_NVARCHAR","S_RGB","S_RedComponent_INT","S_GreenComponent_INT","S_BlueComponent_INT","S_RedComponent_TINYINT","S_RedComponent_SMALLINT","S_RedComponent_BIGINT","S_RedComponent_BIT","S_RedComponent_DEC_15_6","S_GreenComponent_DEC_18_10","RedComponent_SMALLMONEY","RedComponent_MONEY","S_VARCHAR_50","S_CHAR_50","S_NCHAR_50","S_NCHAR_5","S_VARCHARMAX","S_TEXT")
SELECT S."Name_NVARCHAR",S."RGB",S."GreenComponent_INT",S."GreenComponent_INT",S."GreenComponent_INT",S."RedComponent_TINYINT",S."RedComponent_SMALLINT",S."RedComponent_BIGINT",S."RedComponent_BIT",S."RedComponent_DEC",S."GreenComponent_DEC",S."RedComponent_SMALLMONEY",S."RedComponent_MONEY",S."Name_NVARCHAR",S."Name_NVARCHAR",S."Name_NVARCHAR",S."Name_NVARCHAR",S."Name_VARCHARMAX",S."Name_TEXT"
FROM (
SELECT * FROM DP2_109_72ba58ce73a3472db8dce74bc54f827b
) S
And I get this error:
Error (691) Encountered invalid logical page '0' while accessing database 'CSCR1839' (6), object 'DP2_109_72ba58ce73a3472db8dce74bc54f827b' (651146334), index 'tDP2_109_72ba58ce73a3472db8dce74bc54f827b' (255), partition 'tDP2_109_72ba58ce73a3472db8dce74bc54f827b_651146334' (651146334). This is an internal system error. Please contact SAP Technical Support.
ASE is terminating this process.
ct_cancel(): network packet layer: internal net library error: Net-Library operation terminated due to disconnect
There are four rows in the source table. Although the sum of all the VARCHAR columns comes to more than 4000, there is no 4000 bytes in any of the rows. The source TEXT column values are null for three of the rows and 4 bytes for the other row.
The error goes away if I populate the target TEXT column with a literal value.
If I run DBCC checkdb the output contains these lines:
403 | Error (12954) An invalid 'first text page' value (0) was found in data row text pointer 0x00000000000000000000000000000000 for text/image/unitext column 1, in row 0. This row is on page 889, partition ID 651146334, and belongs to the object with ID 651146334. |
403 | Error (12954) An invalid 'first text page' value (0) was found in data row text pointer 0x00000000000000000000000000000000 for text/image/unitext column 1, in row 1. This row is on page 889, partition ID 651146334, and belongs to the object with ID 651146334. |
403 | Error (12954) An invalid 'first text page' value (0) was found in data row text pointer 0x00000000000000000000000000000000 for text/image/unitext column 1, in row 3. This row is on page 889, partition ID 651146334, and belongs to the object with ID 651146334. |
I have restarted the PC and this still happens.
If I drop the tables and recreate them it still happens.
Am I misusing the TEXT column in the source table? If so how is it supposed to be used?