Differences with MS SQL Server
The most important differences between RSQL and MS SQL Server are listed below.
Not Implemented Features
- Stored procedures, views and triggers are not implemented.
- CHECK constraints are not implemented.
- Server-side cursors are not implemented.
- System views are not implemented.
Generality
- In RSQL, only dbo schema exists in a database. It is not possible to create other schemas.
- It is not possible to change the name of login sa.
Syntax
- RSQL doesnt allow single and double quotes in delimited identifiers. MS SQL Server allows it.
Datatypes
- The datatypes
text,varchar(max),ntext,nvarchar(max),imageandvarbinary(max)are not implemented by RSQL.- You should use a NoSQL database to store such data.
- literal string
- The prefix
eallows escape sequence in the string. E.g.e'\u1ebf'.
- The prefix
- literal numeric
- The suffix
dforces literal number to typenumeric.
- The suffix
- literal float
- The suffix
fforces literal number to typefloat.
- The suffix
Operators and Functions
- Implict
CASTfromvarcharorchartonumericis not allowed.- However, explicit cast or implicit cast for assignment are allowed, because in these two cases, p and s are known.
- Explicit
CASTfrom an integer tovarcharorcharraises an error if precision is insufficient.- E.g. RSQL raises an error for the expression
CAST(123456 as varchar(3)). MS SQL Server allows it and returns the string'*'.
- E.g. RSQL raises an error for the expression
- The expression
date + timeis allowed, and the result isdatetime. - The expression
datetime + datetimeis not allowed. - The expression
datetime - datetimeis not allowed. - The function
DATEDIFFfor hour, minute, second returns the true interval.- MS SQL Server returns the number of unit boundary crossings.
- The function
ISNULLforvarbinary,varchar,numericdoesn’t truncate the result.- E.g. for
ISNULL(cast(NULL as varchar(4)), 'abcdefghijkl'), MS SQL Server returns'abcd', which is not intuitive.
- E.g. for
- In the function
CONVERT(varchar, float, style), the style argument is ignored. - The function
RAND()is allowed, but notRAND(seed). - The new function
TYPEOFreturns the type of an expression. - The new function
@@DATEFORMATreturns the DATEFORMAT setting. - The new function
CHARLENreturns the full string length, including trailing blanks. - The new functions
RANDOM_VARCHAR,RANDOM_INT,RANDOM_BIGINT,RANDOM_NUMERIC,RANDOM_FLOAT,RANDOM_DATEcan be used to quickly fill your test tables with random data.
Statements
- The new statement
ALTER SERVER PARAMETERmodifies the server parameters. - The new statement
SHRINK TABLEphysically shrinks table files. - The new statement
BULK EXPORTexports tables or selected rows to text file. - The new statement
SLEEPis equivalent to MS SQL ServerWAITFOR DELAY. - The new statement
SHOWdisplays information about the parameters, databases, tables, users, etc of the current database. - With RSQL, the statement
SET @variable= valuedoesn’t change the value of@@ROWCOUNT.- But with MS SQL Server, this statement sets the value of rowcount to 1.
- With RSQL,
SET LANGUAGEresetsDATEFIRSTandDATEFORMATto language default value.- MS SQL Server keeps the current
DATEFIRSTandDATEFORMATunchanged, but I think this behaviour is confusing.
- MS SQL Server keeps the current
Batches and Scripts
- In RSQL, current database (see
USE) crosses batch boundaries like MS SQL Server.- But current
LANGUAGE,DATEFIRSTandDATEFORMATsettings don’t span to the subsequent batch.
- But current
Errors
With MS SQL Server, a
NULLvalue is returned for division by 0, primary key duplicate, etc. An error message is raised, but the sql script continues, which is often not the expected behaviour.- On MS SQL Server, you must put
SET XACT_ABORT ONat the beginning of the batch to make it abort on arithmetic or integrity error. - On MS SQL Server, you can also set this option at the server level by using the command
sp_configure 'user options', 16384.
- On MS SQL Server, you must put
With RSQL, the default behaviour is always to abort the batch when an error is raised, which is the same as MS SQL Server having the
XACT_ABORToption set to ON.