I'm generating SQL insert statements in Excel, but I've encountered a problem. The primary key of the table these statements apply to is not an auto-incrementing identity. I'm trying to find a way I can get a rowcount in Excel into the insert statements it's generating (thus effectively giving my rows an identity; or at least getting SQL Server to stop complaining upon execution).
Does anyone out there know of anything already built into Excel that will allow me to pull this off? If not, does anyone have any other ideas? Thanks in advance.
rowCount
EDIT : Added example
DECLARE @MaxCount INT
SELECT @MaxCount = MAX(ID) FROM SomeTable
INSERT INTO (ID, ...) VALUES (@MaxCount + 1, ...)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.