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 August 30th, 2006, 08:32 AM
Authorized User
 
Join Date: Nov 2005
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to joxa83 Send a message via Yahoo to joxa83
Default select into and identity

how to create identity column in #test table.
I tried something like this but it doesnt' work.
select *, identity_col= identity(3) into #test from orders

 
Old August 30th, 2006, 08:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

I don't think you can do what you want using SELECT INTO.

You'll have to do it the "hard" way and create the table using DDL (CREATE TABLE #temp ADD COLUMN identitycolumn ... , etc.) then populate the newly created table via INSERT #temp SELECT ... FROM orders etc.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old August 30th, 2006, 10:08 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

yes, you can not create an identity column in a select statement, you must do what Jeff has proposed.

"The one language all programmers understand is profanity."





Similar Threads
Thread Thread Starter Forum Replies Last Post
@@IDENTITY use... neo_jakey Classic ASP Professional 1 May 3rd, 2008 06:47 AM
Reseeding the identity Colonel Angus SQL Server 2000 2 March 10th, 2005 12:06 PM
what does identity do amruthhr SQL Server 2000 2 January 6th, 2005 09:45 AM
identity impersonate stu9820 ASP.NET 1.0 and 1.1 Basics 1 January 7th, 2004 09:47 PM
Identity soccers_guy10 SQL Server 2000 3 September 2nd, 2003 07:05 AM





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