i did this not working... i am using sql 2012
Code:
SET IDENTITY INSERT [telecaster8.1].dbo.[character] ON
INSERT INTO [Telecaster7.4].dbo.[character]
(
[pet] [int] NOT NULL,
[main_title] [int] NOT NULL,
[sub_title_0] [int] NOT NULL,
[sub_title_1] [int] NOT NULL,
[sub_title_2] [int] NOT NULL,
[sub_title_3] [int] NOT NULL,
[sub_title_4] [int] NOT NULL,
[remain_title_time] [int] NOT NULL,
[arena_point] [int] NOT NULL,
[arena_block_time] [datetime] NOT NULL,
[arena_penalty_count] [int] NOT NULL,
[arena_penalty_dec_time] [datetime] NOT NULL,
[arena_mvp_count] [int] NOT NULL,
[arena_record_0_0] [int] NOT NULL,
[arena_record_0_1] [int] NOT NULL,
[arena_record_1_0] [int] NOT NULL,
[arena_record_1_1] [int] NOT NULL,
[arena_record_2_0] [int] NOT NULL,
[arena_record_2_1] [int] NOT NULL,
[alias] [nvarchar](61) NOT NULL, (
SELECT
(
[pet] [int] NOT NULL,
[main_title] [int] NOT NULL,
[sub_title_0] [int] NOT NULL,
[sub_title_1] [int] NOT NULL,
[sub_title_2] [int] NOT NULL,
[sub_title_3] [int] NOT NULL,
[sub_title_4] [int] NOT NULL,
[remain_title_time] [int] NOT NULL,
[arena_point] [int] NOT NULL,
[arena_block_time] [datetime] NOT NULL,
[arena_penalty_count] [int] NOT NULL,
[arena_penalty_dec_time] [datetime] NOT NULL,
[arena_mvp_count] [int] NOT NULL,
[arena_record_0_0] [int] NOT NULL,
[arena_record_0_1] [int] NOT NULL,
[arena_record_1_0] [int] NOT NULL,
[arena_record_1_1] [int] NOT NULL,
[arena_record_2_0] [int] NOT NULL,
[arena_record_2_1] [int] NOT NULL,
[alias] [nvarchar](61) NOT NULL, (
FROM [telecaster81] .dbo.[Character]
Error:
Code:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'IDENTITY'.
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'ON'.
Msg 102, Level 15, State 1, Line 5
Incorrect syntax near 'int'.
Msg 102, Level 15, State 1, Line 29
Incorrect syntax near 'int'.
Quote:
Originally Posted by mongreldogg
SET IDENTITY INSERT [Database 8.1].dbo.[Table] ON
INSERT INTO [Database 8.1].dbo.[Table]
(here list of columns, with primary keys)
SELECT
(same list but for not existing columns insert 0)
FROM [Database 7.4].dbo.[Table]
If table dont have primary keys, dont wirte
SET IDENTITY INSERT [Database 8.1].dbo.[Table] ON
|