SQL -Import records into table with auto ID field

I have a list of emails that I want to import into an table that already has records  with a auto ID field.  I just want the auto ID field to assign a number just like it does when one email is added through the form.  What syntax to I add to the SQL INSERT INTO statement to do that without messing up the data in the table.  The fields are ID, email and date and the table can be called table.

Any help is appreciated,
Thanks
JohnMac328Asked:
Who is Participating?
 
valkyrie_ncConnect With a Mentor Commented:
When you get ready to import the data, run this for the table:

SET IDENTITY INSERT [TableName] ON
GO

When you're done and ready for the identity to start again,

SET IDENTITY INSERT [TableName] OFF
GO

hth

valkyrie_nc
0
 
JohnMac328Author Commented:
Thanks
0
 
JohnMac328Author Commented:
Is it possible to set that value in the table manually?  I tried running the statement in a query and I got an error.
0
 
valkyrie_ncCommented:
You can only do it prior to an INSERT statement of some kind (whether T-SQL or SSIS or whatever doesn't matter AFAIK).

Post your code and error message and I'll see if I can help.
0
 
JohnMac328Author Commented:
No problem, I got it.

Thanks for writing back.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.