Skip to content
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

Uninstall.sql: Drops table dbo.SqlServerVersions: Only in current database / Regardless of @printOnly / Not part of PRINT #2893

Closed
andreasjordan opened this issue May 10, 2021 · 2 comments · Fixed by #2894
Assignees

Comments

@andreasjordan
Copy link
Contributor

Version of the script
Current dev-branch at GitHub

What is the current behavior?
The table dbo.SqlServerVersions is only dropped in current database
The table dbo.SqlServerVersions is dropped regardless of @printOnly
The drop statement is not included in the PRINT output

If the current behavior is a bug, please provide the steps to reproduce.
Just have a look at the code:

IF OBJECT_ID('dbo.SqlServerVersions') IS NOT NULL
DROP TABLE dbo.SqlServerVersions;

What is the expected behavior?
In the first case (only current database) I am not sure, because it may be risky to delete all tables dbo.SqlServerVersions in all databases.
In the second case (regardless of @printOnly) I would expect that @printOnly does not delete any objects, so does not drop the table.
In the third case (PRINT output) I would expect the DROP TABLE to be included in the PRINT. This is how I found the bug: I have missed the statement and so I had a look at the code.

If you want me to code that and open a pull request, just give me a hint.

@BrentOzar
Copy link
Member

Sure, if that's important to you and you want to contribute the code, give 'er a shot. Thanks!

@BrentOzar
Copy link
Member

Thanks for the pull request. Merging into the dev branch, will be in the May release with credit to you in the release notes.

@BrentOzar BrentOzar added this to the 2021-05 Release milestone May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants