squirrel icon indicating copy to clipboard operation
squirrel copied to clipboard

No way to add options between INTO and VALUES on INSERT (likely MS SQL specific)

Open dmakushin opened this issue 2 years ago • 2 comments

MS SQL has a specific way for definition of returning values. It is similar to Postgres' RETURNING ID but should be placed in the middle of the query, so suffix is not applicable.

Example (from stackoverflow):

INSERT INTO MyTable(Name, Address, PhoneNo)
OUTPUT INSERTED.ID
VALUES ('Yatrix', '1234 Address Stuff', '1112223333')

dmakushin avatar Dec 21 '22 11:12 dmakushin

What about adding of some generic method which can be used for specification of returning value for all kind of drivers? It could be complex since the query clause which specifies it can be related to different parts of the query depending on SQL dialect.

dmakushin avatar Dec 21 '22 12:12 dmakushin

Any update on this? Is this planned? I would really love to see a returning or output for the ID of the inserted dataset.

DrBlury avatar Feb 11 '23 11:02 DrBlury