Closed SimplyAdam closed 8 years ago
Just trying to be helpful..
SqlServerProvider class. Line 185.
Perhaps instead of appending the SCOPE_IDENTITY to the command text, perhaps replacing the value(
with something like string.format("OUTPUT Inserted.{0} value(", idKey)
. Dirty-ish workaround, but would work across all primary key types.
The "OUTPUT Inserted.Id" is already used in SqlFu 3 (not released). I'll see how easy it is to integrate into v2, when I'll have some spare time. In the mean time, I accept a PR :)
Awesome to hear! Looking forward to using SQLFu in the new projects :-)
Accept PR? Sorry, not familiar with that?
PR means Pull Request
SCOPE_IDENTITY is only useful for numeric identity columns. Since choosing Guid primary keys using newid() or newsequentialid() is getting more common, it would be good if InsertedId method would come back with the generated uniqueidentifier rather than DBNull.
Only way I know of is using the "OUTPUT Inserted.Id" where Id is the name of the primary key in the INSERT statement.