Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Copy Records
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01119791
Message ID:
01121058
Views:
22
Sergey, different tables here, same question.

I made a copy of a table for backup purposes. I now want to restore from it:
insert into result_detail
  select * from result_detail_old
SQL throws:
"An explicit value for the identity column in table 'result_detail' can only be specified when a
column list is used and IDENTITY_INSERT is ON."

I tried SET IDENTITY_INSERT result_detail OFF





>It should be
>insert into column_headers
> (type, field_key, caption, display, sequence, width1, width2, align, isdefault)
>  select 'lf_tree',
>         field_key,
>...
>
>
>
>>I need to pull all records from the Column_Headers table below, change the 'type' column to read 'lf_tree'
>>and then insert them back into the table, so that I will then have 2 sets of records, one with a type
>>of 'sf_tree' and another with a type of 'lf_tree'
>>
>>Can I do this in the Query Analyzer?
>>
>>
>>id  type    field_key  caption    display  sequence width1 width2 align isdefault
>>--------------------------------------------------------------------------------------------
>>44  sf_tree airdate    Air Date         1	  1     75     75     0	        1
>>45  sf_tree airtime    Air Time         1	  2     40     40     0	        1
>>46  sf_tree progtitl   Program          1	  3    137    137     0	        1
>>47  sf_tree statname   Station          1	  4    115    115     0	        1
>>48  sf_tree clientid   Client Id        1	  5     45     45     0	        1
>>49  sf_tree lmarket    Market           1	  6    120    120     0	        1
>>50  sf_tree refnum     Ref Num          1	  7     65     65     0	        1
>>
>>
>>I tried this, but SQL just duplicates the records:
>>
>>
>>insert into column_headers
>> (type, field_key, caption, display, sequence, width1, width2, align, isdefault)
>>  select type as 'lf_tree',
>>         field_key,
>>         caption,
>>         display,
>>         sequence,
>>         width1,
>>         width2,
>>         align,
>>         isdefault
>>  from column_headers
>>  where type = 'sf_tree'
>>
>>
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform