Code Inspections in SQL server
This topic lists all GoLand code inspections available in SQL server.
You can toggle specific inspections or change their severity level on the Editor | Inspections page of settings Ctrl+Alt+S.
Inspection | Description | Default Severity |
---|---|---|
Builtin functions | Reports truncations of string arguments in ISNULL functions. The ISNULL syntax is According to ISNULL at docs.microsoft.com, Example (Microsoft SQL Server): 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); | Warning |
ORDER BY in queries | Reports usages when the For more information about usages of Example (Microsoft SQL server): 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;
| Error |