PROTOCOLS · SQL SERVER
T-SQL, TDS 7.4 and 8.0, EF Core 10.
SQL Server applications connect with Microsoft.Data.SqlClient and keep their T-SQL batches, their EF Core migrations and their SqlBulkCopy loads. The answers follow SQL Server's rules, down to collation, GUID order and error numbers.
1 / 3
Connection
TDS 7.4 with TLS inside PRELOGIN, or TDS 8.0 with Encrypt=Strict and TLS first. SQL batches and the RPC calls drivers use: sp_executesql, sp_prepare, sp_prepexec, sp_execute, sp_reset_connection. Typed parameters are bound through the engine and never written into the SQL text.
shell
rasterizeddb_core --mssql-port 1433 sqlcmd -S 127.0.0.1,1433 -U superuser
2 / 3
Batches that behave like SQL Server's
- No ; needed; an error ends its statement and the batch goes on, unless XACT_ABORT
- DECLARE, SET @v, IF … ELSE, WHILE, BEGIN TRY … BEGIN CATCH, THROW, RAISERROR, PRINT
- Nested BEGIN TRAN with @@TRANCOUNT; IMPLICIT_TRANSACTIONS and isolation levels
- CROSS / OUTER APPLY, TOP, OFFSET … FETCH, OUTPUT INSERTED / DELETED
- EF Core's batched MERGE inserts, sp_getapplock, sp_rename, filtered unique indexes
- sys.tables, sys.columns, INFORMATION_SCHEMA, OBJECT_ID, SERVERPROPERTY, @@VERSION
3 / 3
SQL Server's answers, not approximate ones
- Case-insensitive text by default, as SQL_Latin1_General_CP1_CI_AS, in keys, joins, GROUP BY and foreign keys (--mssql-collation bin turns it off)
- uniqueidentifier orders in SQL Server's byte-group order, so keyset paging matches
- datetime2(7), datetimeoffset(7) and time(7) keep 100 ns exactly
- Names show as declared, in mixed case, in results, sys.* and errors
- Errors 547, 2627 and 2601 with SQL Server's wording
- SqlBulkCopy with KeepIdentity, IDENTITY_INSERT, SCOPE_IDENTITY