Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2005, 07:15 AM
Registered User
 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQLSERVER SQL

Sir,

What is the alternative to Oracle's command

insert into table2 (select * from table1)

I have got two table's in 2 databases. The first database is BCCI and the second database is TEST. The BCCI table contains one table HR_EMPMAS and contains data. There is the same table in the TEST database which is empty.

When I am firing the statement

INSERT INTO HR_EMPMAS SELECT * FROM BCCI.DBO.HR_EMPMAS

the following message is shown

Server: Msg 8101, Level 16, State 1, Line 1
An explicit value for the identity column in table 'HR_EMPMAS' can only be specified when a column list is used and IDENTITY_INSERT is ON.


Love, light and peace
 
Old March 31st, 2005, 10:29 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

INSERT INTO HR_EMPMAS (field1, field2,...)
SELECT (field1, field2,...) FROM BCCI.DBO.HR_EMPMAS

where field1,field.. are all the table columns( fields) without identity column


 
Old April 4th, 2005, 08:37 PM
Authorized User
 
Join Date: Mar 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yep
shahchi1 is right

atul






Similar Threads
Thread Thread Starter Forum Replies Last Post
SQLServer Express lizhaskin SQL Language 1 July 6th, 2007 05:40 AM
SQLserver 2000 vs SQLserver 2005 Express cJeffreywang BOOK: Beginning ASP.NET 2.0 and Databases 0 April 22nd, 2007 09:52 AM
SqlServer instance Angela_SB .NET Framework 2.0 0 February 15th, 2007 05:13 PM
connecting to sqlserver HalehMardanian ASP.NET 2.0 Basics 1 July 18th, 2006 04:04 AM
Import SQL 2K query into SQLServer under version toantvo SQL Server 2000 3 September 3rd, 2004 08:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.