SQL Server front-end (T-SQL)

Tools, administration and frameworks (stage 5)

What SSMS, Azure Data Studio, DBeaver and the frameworks read, logins and permissions that are enforced, administration statements, and the framework smoke runs.

The catalog still differs from SQL Server in some details (listed on the limits page).

What tools and projects meet first. The catalog views have the columns SQL Server has, in its order (the content may be small): sys.databases (with master, tempdb, model, msdb), schemas, tables, views, objects / all_objects, procedures, triggers, sql_modules, types, columns, indexes, index_columns, foreign_keys, key_constraints, check_constraints, default_constraints, computed_columns, identity_columns, sequences, parameters, synonyms, extended_properties, partitions, configurations, the principal and permission views, database_files, the legacy sysobjects and its neighbours, sys.dm_os_host_info, dm_os_sys_info, dm_exec_sessions / requests / connections (every session of the server), dm_db_partition_stats, and msdb.dbo.sysjobs and neighbours. About 60 system procedures were added (sp_server_info, sp_datatype_info, sp_pkeys, sp_fkeys, sp_statistics, sp_special_columns, sp_sproc_columns, sp_columns_100, sp_helpdb, sp_helpindex, sp_helpuser, sp_configure, sp_addextendedproperty, sp_who2, ...), with the functions OBJECT_DEFINITION, HAS_PERMS_BY_NAME, IS_MEMBER, SUSER_ID, USER_ID, COL_NAME, IDENT_CURRENT, fn_listextendedproperty.

Logins, users, roles, permissions that are enforced. CREATE | ALTER | DROP LOGIN, CREATE | ALTER | DROP USER, CREATE ROLE, ALTER ROLE ... ADD | DROP MEMBER, GRANT | DENY | REVOKE on objects, the schema dbo, the database and a login's server permissions, EXECUTE AS USER | LOGIN, REVERT, SETUSER, sp_addrolemember and friends. A login made with CREATE LOGIN connects (error 18456 for a wrong password, Reason: The account is disabled., 4060 without a user in the database); sa and members of sysadmin are never checked; everyone else is checked before each statement: The SELECT permission is not granted to you on object 't' (database 'master', schema 'dbo'). (229), Permission to run CREATE TABLE was denied in database 'master'. (262), 3701 for a drop, The EXECUTE permission was denied ... for a procedure. A DENY on the user or one of its roles wins; the fixed roles db_owner, db_datareader, db_datawriter, db_ddladmin, db_denydatareader, db_denydatawriter act as they do; code inside a procedure, function or trigger is not checked (ownership chaining with the one owner dbo), so GRANT EXECUTE on a procedure opens the tables behind it. Permissions on columns are enforced since stage 6.

Administration. DBCC CHECKDB | CHECKTABLE | CHECKIDENT | SHOWCONTIG | USEROPTIONS | SQLPERF | OPENTRAN and the commands that only close with DBCC execution completed... answer as on a healthy database; UPDATE STATISTICS, CREATE | DROP STATISTICS, ALTER INDEX ... REBUILD | REORGANIZE, CREATE COLUMNSTORE INDEX, CHECKPOINT, ALTER DATABASE ... SET are accepted and change nothing; CREATE | DROP PARTITION FUNCTION | SCHEME are recorded (a table ON ps(col) is one table); sp_configure + RECONFIGURE keep and show the values of 35 options without effect; SET STATISTICS IO | TIME ON print their lines; SET SHOWPLAN_TEXT | ALL | XML ON answer with a plan that is a Table Scan per table (the statement is not run); SQL Server Agent jobs (msdb.dbo.sp_add_job, sp_add_jobstep (TSQL), sp_add_schedule, sp_attach_schedule, sp_start_job, sp_help_job, sp_delete_job) are kept and sp_start_job runs the steps at once in the calling session with a row of history; since stage 6 an agent thread fires the schedules (see "Stage 6").

Refused with SQL Server's text or the usual 40000 and listed: CREATE | ALTER | DROP ASSEMBLY and CREATE AGGREGATE (6263 Because it is turned off, user code cannot run under the .NET Framework. Turn on the "clr enabled" server setting.), Service Broker, Always Encrypted keys, endpoints, availability groups, certificates and keys, Resource Governor, audits, external data sources, linked servers, XML schema collections and XML or spatial indexes, rules, application roles, SHUTDOWN, a job step that is not TSQL, DBCC SHOW_STATISTICS, a filtered index other than a unique one WHERE col IS NOT NULL.

Framework runs: SQLAlchemy 2.0 mssql+pyodbc (create_all, reflection, ORM), Django 5.0 with mssql-django 1.8 (migrate of contenttypes, auth and an app, ORM; mssql-django sets MARS_Connection and the server answers it (stage 6)), Entity Framework Core 9 (EnsureCreated, __EFMigrationsHistory, MERGE ... OUTPUT INSERTED, OFFSET / FETCH, ExecuteUpdate, concurrency tokens, transactions) with Dapper, DatabaseMetaData of the Microsoft JDBC driver and the statement shapes of Hibernate 6 (Hibernate itself was not run), TypeORM 0.3 on tedious. Not run: mssql+pymssql, Hibernate, Prisma, dotnet ef migrations.