7

Note: I'm not going to comment on the query itself, but I'm going to instead talk about something which also impacts this, considering the size of this query. Some basic math, assuming the average size of data inside varchar columns is 30 characters and columns are roughly split between the 3 types: 101 columns * ((30+8+4)/3) = 14 bytes per column * 4,000,...


3

I assume by everything you mean db_owner rights. Not Sysadmin rights. If you can't trust them not to drop a database, they should not have access to most things you can do with Sysadmin. What you want is described in the answer here https://dba.stackexchange.com/a/163437/21924 So in effect, you can create a user that has all the rights of db_owner ...


2

NULL is not a value of the column but an internal metadata flag showing the column has no value. So duplicating this in user space by adding another flag column is a waste. NULL is a well-supported part of the relational model. Use it for its intended purpose.


2

This builds the table you are looking for: WITH ImportantDates AS ( SELECT * FROM ( VALUES /* This approach assumes Important Dates are continous A better approach would be to build from start dates to ensure that it s. */ (2020,1 ,'2019-10-27','2019-11-23') ...


1

Which system catalog view has the create_date of a database which name was modified? Or an alternative reliable method if such view doesn't exist. You're correct in your assessment of create_date in sys.databases, which is confirmed by the documentation: Date the database was created or renamed. So the create_date is the ideal value to use as the end ...


1

I prefer to use db_owner Not using Sysadmin. And use Server Trigger to prevent delete database accidentally Like this : To create a DDL trigger with server scope (ON ALL SERVER) or a logon trigger, requires CONTROL SERVER permission on the server https://docs.microsoft.com/en-us/sql/t-sql/statements/create-trigger-transact-sql?view=sql-server-ver15#...


1

Refering to this page Install SQL Server 2016 R Services (Microsoft | SQL Docs) it clearly states in step 3.: Important Do not install R Server and R Services at the same time.


Only top voted, non community-wiki answers of a minimum length are eligible