Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Turning the AutoNumber property Off in SQL Server

Posted on 2013-06-22
2
Medium Priority
?
614 Views
Last Modified: 2013-06-23
I need to insert predefined autonumbers from another table into a new table. Is there a way to turn the AutoNumber property off in the new table, insert the records, then turn the property back on?
0
Comment
Question by:SpaceCoastLife
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 39268374
SET IDENTITY_INSERT OFF

-- Do your inserting into a tale with an identity column here

SET IDENTITY_INSERT ON

http://msdn.microsoft.com/en-us/library/aa259221(v=sql.80).aspx
0
 

Author Closing Comment

by:SpaceCoastLife
ID: 39269690
Thanks for the help
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question