Code Inspections in SQL server
This topic lists all JetBrains Rider code inspections available in SQL server.
You can toggle specific inspections or change their severity level on the Editor | Inspection Settings | Inspection Severity | Other Languages page of the IDE settings Ctrl+Alt+S.
Inspection | Description | Default Severity |
---|---|---|
Builtin functions | Reports truncations of string arguments in ISNULL functions. DECLARE @name1 VARCHAR(2) = NULL;
DECLARE @name2 VARCHAR(10) = 'Example';
DECLARE @name3 VARCHAR(2) = 'Hi';
-- `@name2` is VARCHAR(10) and will be truncated
SELECT ISNULL(@name1, @name2);
-- `@name3` is VARCHAR(2) as `@name1` and will not be truncated
SELECT ISNULL(@name1, @name3); | |
ORDER BY in queries | Reports usages when the CREATE TABLE foo (a INT NOT NULL, b INT NOT NULL);
SELECT *
FROM (SELECT a, b
FROM foo A
WHERE a < 89
ORDER BY b) ALIAS;
In a subquery, ORDER BY will be highlighted as an error. You can add TOP, OFFSET, or FOR XML to a subquery. Alternatively, use the Delete element quick-fix to delete the ORDER BY section. After the quick-fix is applied: SELECT *
FROM (SELECT a, b
FROM foo A
WHERE a < 89) ALIAS;
|