SQL Server
SQL Server 2017 (14.0) and newer is reached over TDS: a profile has driver = "sqlserver" (or
"mssql"), and a URL starts with sqlserver:// (or mssql://), port 1433 unless it names
another (Configuration). An older server is refused when it
answers, with the version it needs. CI runs the driver’s tests against SQL Server 2022 and 2025.
Azure SQL Database and Azure SQL Managed Instance are allowed but untested: CI does not reach
them, and nobody has tried datarig there yet
(#678).
Signing in. A profile signs in with a SQL login, a user name and its password, and nothing
else: Windows sign-in, Kerberos and Microsoft Entra ID are not offered
(#673). TLS follows the profile’s mode, as for
the other engines (TLS and SSL); the form says what each mode is in SQL Server’s words
(Encrypt, TrustServerCertificate). SSH tunnels work as for PostgreSQL and MySQL.
One database. A profile works in its own database (the login’s default database when the profile names none). The explorer lists that database alone, and datarig offers no way to move a tab to another (#675).
Read-only profiles are refused. A read-only profile does not connect, and nothing is sent: no setting of a SQL Server session keeps it read-only, the way PostgreSQL’s and MySQL’s settings do (#671).
GO batches. Text is sent one GO batch at a time: a run takes the batch under the cursor,
or each batch of the selection, whole, so that a variable lives for its batch. Each statement of
a batch is checked as on any engine, and the batch asks or is refused when one of them would. A
GO line with a count (GO 2) is refused, as is one with more on it or one inside a string or
a comment, and nothing of the text is sent (SQL editor).
Several result sets. A batch that gives several result sets shows the first, and says how many more were read and not shown. Showing them all is #705.
Lookups never wait for a lock. The explorer’s lookups (the schemas, the tables of a schema, a table’s structure, the keys, a DDL) never wait inside the server for another session’s lock. When a lock is in the way, datarig asks again three times within about 0.6 s, so a lock the server holds only for a moment (as it does while it updates the statistics of its own catalogue after tables were created or dropped) does not show. A schema change another session has not committed still makes the lookup say the object is locked, after those 0.6 s (#689).
Dates and sql_variant in SQL. SQL Server reads a datetime or a smalldatetime written
2026-01-02 10:00:00 by the session’s date format, which its language sets: under
SET LANGUAGE British that is 1 February, and a day after the 12th is no date at all. Copy as
SQL and the SQL export write every date and time with a T (2026-01-02T10:00:00.000), which
every language and DATEFORMAT reads the same, as edits and filters do. They and edits write a
date alone as a typed literal, CAST(N'2026-01-02' AS date). As text, N'2026-01-02' reads the
same in a date column under every setting, but run into a datetime or smalldatetime column
of another table it is read by the date format as well (1 February under British); typed, it is
the same day under every language and date format, and the same text in a text column. A time
alone has no day and month to swap, and is written as text. A sql_variant is shown
as the value it holds (an int 5 as 5, bytes as 0x…), but written as SQL it would be text
(N'5'), which the column stores as nvarchar: Copy as SQL and the SQL export refuse each such
value and name its column, the export keeps only the rows before it, and y keeps no cells of it
for g p. NULL is written as NULL, and the CSV and JSON exports write every value as shown.
What datarig does on SQL Server
| What | On SQL Server | Notes |
|---|---|---|
| Connect | Yes | SQL Server 2017 and newer; TLS by the profile’s mode, SSH tunnels. Azure SQL Database and Managed Instance untested. |
| Sign in | Partly | A SQL login only: no Windows sign-in, Kerberos or Entra ID. |
| Databases | Partly | The profile’s database only: no switching to another. |
| Read-only profiles | No | Refused before anything is sent. |
| Read tables and run statements | Yes | One GO batch at a time, each statement judged by SQL Server’s own rules; GO 2 is refused. |
| Several result sets | Partly | The first is shown, and the rest are counted in a note. |
| Filter a table | Yes | LIKE takes the case rule of the column’s collation, which most often ignores case (Filtering). |
| Export | Yes | CSV, JSON and SQL; a table whose key is whole numbers, decimals or Unicode text in chunks (Export). |
| Copy as SQL | Partly | Text as Unicode strings (N'…'), bytes as 0x…, dates and times with a T, a date alone as CAST(N'…' AS date); a sql_variant value is refused (see Dates and sql_variant in SQL, above). |
| Edit and apply | Yes | One transaction per apply that never waits for another session’s lock; a table with triggers is refused. How rows are found is below (Editing data). |
| Manual commit | No | Not built for SQL Server yet (#677). A BEGIN TRAN you type is followed. |
| Show and open DDL | Yes | A view’s, procedure’s, function’s or trigger’s text as the server keeps it; a table written from the catalogue. An encrypted module is refused. |
| Query plans | Yes | The XML showplan; with ANALYZE measured with STATISTICS XML and rolled back, with the refusals below (Plans). |
| Row estimates | Yes | The root’s estimate of the plan, never run. |
| Startup SQL | Partly | Only SET of DEADLOCK_PRIORITY, LOCK_TIMEOUT, NOCOUNT, XACT_ABORT and TRANSACTION ISOLATION LEVEL (Startup SQL). |
| Cancel a running statement | Yes | TDS’s attention signal on the session’s own connection; the tab’s connection stays open. |
| Server monitor | No | Not built for SQL Server yet (#672). |
Plans and ANALYZE
Space e x asks for the plan with SET SHOWPLAN_XML ON: the server plans the batch and runs
none of it. A batch with a statement that would take effect even so (a SET of an option, a
USE) is refused.
Space e a measures the statement with SET STATISTICS XML ON, inside a transaction of its own
that is rolled back (inside your open transaction, rolled back to a savepoint). Only one
SELECT, INSERT, UPDATE, DELETE or MERGE is measured. Refused, with nothing sent:
- DDL (
SELECT … INTOtoo), a procedure, a batch of several statements, and a transaction or session statement; - a write that names a table with a trigger that is on, or reaches one through a cascading foreign key, a view, an inline function, a synonym, or another database’s table;
- every measured write of an account that cannot see the whole catalogue (without
VIEW DEFINITIONon the database a trigger could be missed).
An identity value or a sequence number a measured write took is not given back. Query plans says how the plan is read.
Editing rows
A result’s rows are edited as on the other engines (Editing data), with these rules on SQL Server:
- Finding a row. A row is found by the table’s primary key, or a
NOT NULLunique key, when the result shows all its columns and each compares exactly; else by the values of its columns that compare exactly. Adatetimeoffset(it compares as the instant),text,ntext,image, a CLR type and asql_variantdo not. Text is compared under a binary collation and by its length, since=alone ignores trailing spaces. An update also checks that each changed column that compares exactly still holds the value read, and a delete every column that compares exactly. - Locks. Each row is read again by its key under an update lock before it changes, and the Apply never waits for another session’s lock: a locked row fails it, and nothing is applied.
- Counts. Each statement must touch exactly one row. A table with triggers is refused, since the rows a change touches could not be counted; a row found by its values that matches several rows is not written; and a row whose change the server counts otherwise than once fails the Apply.
- Left to the server. An identity,
rowversionor temporal period column is never written. The server returns no rows, so a new row’s identity and other defaults staydefaultuntil the query runs again. - Open transactions. Nothing is sent while a transaction is open in the tab: on SQL Server an error in it could roll the whole transaction back. Commit or roll back first.
- Code pages. A
char,varcharortextcolumn (or a type of your own over one) keeps its text in its collation’s code page, and the server stores a character the code page lacks as?or as a character like it (ébecomesein a Korean column) without a word. A typed value is taken when the column’s code page holds each of its characters: every character under a_UTF8collation,éand€under a Latin1 one (code page 1252), Hangul under a Korean one (949). Otherwise it is refused, naming the first character the code page lacks. The Windows code pages 874 and 1250 to 1258, 932 (Japanese) and 949 (Korean) are checked character by character; under any other (936 and 950, Chinese; 437 and 850) a value outside ASCII is refused.varchar(n)holdsnbytes of the code page, so a character that takes two counts twice. - Lengths. A typed or pasted value longer than its column holds is refused at the cell,
before anything is sent:
char(n)andvarchar(n)count bytes of the code page,nchar(n)andnvarchar(n)count UTF-16 code units (an emoji or another character outside the Basic Multilingual Plane takes two), andbinary(n)andvarbinary(n)count bytes. A type of your own over one of them counts as that type. The(max)types have no limit here. ANSI_WARNINGS. Each session starts withANSI_WARNINGSon. WithSET ANSI_WARNINGS OFFrun in the tab, the server cuts a value too long for its column and says nothing, so an Apply then sends nothing and says why.SET ANSI_WARNINGS ONturns it back on, and runs without dropping the pending changes.- Reading under other code pages. Text read from a
char,varcharortextcolumn is decoded with its code page’s table. Under the code pages above the table agrees with the server’s. Under 936 and 950 it does not for some characters (936’s0xA2E3is a private-use character on the server and€in the table; about a hundred such characters in 936, about five thousand in 950, most in their user-defined areas), so there a value with any character outside ASCII counts as not shown whole: the grid still shows it as decoded, but every copy and export of it refuses it and says so (Copy as SQL, the TSV, CSV, JSON and other text copies, and the SQL, CSV, JSON and other exports), and so do a filter by its value and an edit that must find its row again. ASCII values work as anywhere else.nchar,nvarcharandntextare not affected. A value held in asql_variantcannot be marked, so asql_variantholding text of 936 or 950 outside ASCII fails its result instead (“code page 936 text in a sql_variant can’t be read exactly here, so the result isn’t shown”); the session stays. - Values the table does not decode. Some bytes a column holds are not in its code page’s
table here: 949’s and 950’s user-defined areas (private-use characters on the server), a few
single bytes of 932 and 936, and every byte outside ASCII under 437 and 850, which have no
table here. Such a value is shown as the replacement character and its bytes (
�0xC9A1) in the look of NULL, and the cell viewer and the inspector say it was not decoded from its code page; the other rows and columns of the result read as usual. It is never taken for text: Copy as SQL, the text copies, every export, a filter by its value and an edit that must find its row refuse it and say so. Under 437 and 850, values all in ASCII read, copy and export as anywhere else. Asql_variantholding such a value fails its result, naming the code page; ASCII text in asql_variantreads under every code page, 437 and 850 included. TEXTSIZE. Each session starts with noTEXTSIZElimit, sovarchar(max),nvarchar(max),varbinary(max),text,ntextandimagevalues come whole. WithSET TEXTSIZE nrun in the tab, the server sends at mostnbytes of each such value (half as many characters ofnvarchar(max)andntext). From then on a column of those types counts as not shown whole: the grid shows what came, but every copy and export refuses it and says so, and so do a filter by its value, the count of its values a filter lists, and an edit that must find its row (one that would have found another row, whose whole value is the cut one). Your setting is never changed, and never read behind your back: datarig follows what the tab runs.SET TEXTSIZE 2147483647(or-1) alone lifts the limit, and the next read is whole again. A statement that may set it in another way (a batch or dynamic SQL that namesTEXTSIZE, one that failed) leaves it not known, so those columns count as not shown whole untilSET TEXTSIZE nruns alone. Sized types andxmlare never cut. A procedure that sets its ownTEXTSIZEreturns its own result sets cut as it chose, asLEFT(…)would, and datarig does not mark those values; the setting ends with the procedure, so later reads are whole.