troubleshooting Question

Auto Increment the PersonID field using Invoke-Sqlcmd in Powershell

Avatar of abuhaneef
abuhaneefFlag for United States of America asked on
Microsoft SQL ServerSQL
5 Comments1 Solution23 ViewsLast Modified:
I have a non Primary Key PersonID in person. How do I auto increment the PersonID field using Invoke-Sqlcmd in Powershell.  

INSERT INTO person (firstname, lastname, title, entityid, workgroupid, supervisorid, did, BirthDate, HireDate, type, site, remote, email, HRID) VALUES ('Trey', 'Songz', 'Manager - Customer Support', '308', '272', '4691', '610-504-6644', '12/12/1977 00:00:00', '04/20/2020 00:00:00', 'Employee', 'Denver, CO', '1', '', '6700');
Máté Farkas
SQL Server Consultant
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros