Link to home
Start Free TrialLog in
Avatar of Tim
TimFlag for United States of America

asked on

Dynamically add Ids by 1 in SQL insert.

Hello Experts,

I am inserting data into a single table and I would like to do this in bulk. The only thing that is stopping me is one field that does not accept nulls and is an id that I assign to each item. I am trying to create a procedure that will dynamically add this field (i++) instead of me going in one by one.

Is this possible? Do I need to use script?

thanks.
ASKER CERTIFIED SOLUTION
Avatar of Walter Ritzel
Walter Ritzel
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tim

ASKER

Is there a way of doing this without modifying the table?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tim

ASKER

Ok, but what if there are two fields? Will MS SQL let me have two fields with Identity turned on?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tim

ASKER

Thanks.