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

Add option to update/refresh data rather then dropping table #5

Closed
reharmsen opened this issue Jul 4, 2018 · 3 comments
Closed

Add option to update/refresh data rather then dropping table #5

reharmsen opened this issue Jul 4, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@reharmsen
Copy link
Contributor

Thanks for adding the primary key.
I do have an issue with using the produced script.

Due to the replication I am not able/allowed to drop the table.
"Cannot drop the table 'dbo.SqlServerVersions' because it is being used for replication."

Would be nice if there was a commandline option which let's you decide to create a full script (including creation of the table), or 'just' the data, with an additional DELETE statement to clean the table first.

DELETE
FROM dbo.SqlServerVersions

@jadarnel27
Copy link
Owner

Gosh, can you tell I've never used replication?

I like your proposed solution. But as I think about it, dropping the table feels a bit unnecessary in the default case. I'm thinking I'll change to TRUNCATE / DELETE as the default behavior - rather than through a command line option.

What do you think about that?

If the schema of the table ever needs to be changed, detection of old schemas / migration can be included then.

@reharmsen
Copy link
Contributor Author

We are using a 'central' database DBADB which we replicate into our infrastructure.
Similar to what has been explained here http://allen-mcguire.blogspot.com/2014/11/work-smarter-not-harder-utility-instance.html
This allows us to just install/manage our utility scripts/procedures and tables at one central location.
We use the SqlServerVersions table in conjunction with the FirstResponderKit from Brent

Creating the table only when it is not there yet, and always doing a DELETE first would work. TRUNCATING is not supported.

@jadarnel27
Copy link
Owner

Great! Thanks for the tip on TRUNCATE not being supported, I'm glad you mentioned it.

I'll get this added in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants