-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix #79 * fix #80; add new rule 243 for invalid datepart expressions * groundwork for aggregate * fix #81; add new rule DAP244 for mixing aggregate and non-aggregate data
- Loading branch information
Showing
12 changed files
with
301 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# DAP243 | ||
|
||
Date functions like `DATEADD`, `DATEPART` expect a *datepart* token as the first argument; for example in | ||
|
||
``` sql | ||
DATEPART(year, GETDATE()) | ||
``` | ||
|
||
the `year` is the *datepart* token. These values cannot be parameterized or take a value | ||
from a column - they are a special kind of literal value. | ||
|
||
For the list of valid tokens, see [here](https://learn.microsoft.com/sql/t-sql/functions/dateadd-transact-sql). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# DAP244 | ||
|
||
A `SELECT` expression cannot mix aggregate and non-aggregate results; | ||
|
||
Fine: | ||
|
||
``` sql | ||
select Name | ||
from SomeTable | ||
``` | ||
|
||
or | ||
|
||
``` sql | ||
select COUNT(1) | ||
from SomeTable | ||
``` | ||
|
||
Invalid: | ||
|
||
or | ||
|
||
``` sql | ||
select Name, COUNT(1) | ||
from SomeTable | ||
``` | ||
|
||
Aggregate functions are [listed here](https://learn.microsoft.com/sql/t-sql/functions/aggregate-functions-transact-sql). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.