-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQLServer: ExecuteDelete without Where should translate to TRUNCATE TABLE #34957
Comments
Plenty of reasons why this is fundamentally different.
|
Yeah, I tend to agree with @Bretttt and @cincuranet on this - IIRC there are some observable difference between the two. For example, unless I'm mistaken, identity columns are reset by TRUNCATE but not by DELETE... For cases where there are observable differences, it's probably better to also keep the .NET user-facing API distinct so that everything is clear and predictable, rather than having a weird thing where just adding/removing a Where clause suddenly leads to behavioral differences... @Bretttt's point about TRUNCATE not returning rows is also good and points in the direction of a separate API. We can indeed add an API here, though this really is an extremely simply command to do via SQL Note previous discussion on introducing TRUNCATE to EF in #5972. |
Also, TRUNCATE requires higher rights than READ or WRITE |
Today, the following statement...
...translates to the following on SQL Server.
But it would be more performant to use a truncate statement.
The text was updated successfully, but these errors were encountered: