I have a Database that is corrupted, backup and restore does not work, the table contains 180 million records with a total size of 1TB.
I need to copy the data from the table to another, but it is very slow because the tables contain 3 columns with VARCHAR, I've already tried Linked Server, Bulk copy, BCP and SSIS, but they are all taking a long time, to copy 50 million records It's taking 30 hours.
I did the test without the 3 VARCHAR(MAX) columns and it runs very fast.
CREATE TABLE [dbo].TABLE_01
(
Column_1 [bigint] NOT NULL,
Column_2 [varchar](50) NOT NULL,
Column_3 [datetime] NOT NULL,
Column_4 [varchar](39) NULL,
Column_5 [int] NULL,
Column_6 [varchar](100) NULL,
Column_7 [varchar](100) NULL,
Column_8 [int] NULL,
Column_9 [varchar](30) NULL,
Column_10 [int] NULL,
Column_11 [varchar](100) NULL,
Column_12 [varchar](100) NULL,
Column_13 [int] NULL,
Column_14 [varchar](30) NULL,
Column_15 [int] NULL,
Column_16 [varchar](30) NULL,
Column_17 [varchar](250) NULL,
Column_18 [int] NULL,
Column_19 [varchar](30) NULL,
Column_20 [varchar](250) NULL,
Column_21 [varchar](max) NULL,
Column_22 [varchar](max) NULL,
Column_23 [varchar](max) NULL
)
Is there another way to do this procedure faster?
Thanks.