We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ErikEJ/SqlServer.Rules'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
SRD0014.md•1.06 KiB
# SQL Server Rule: SRD0014
| | |
|----|----|
| Assembly | SqlServer.Rules |
| Namespace | SqlServer.Rules.Design |
| Class | TopWithoutOrderByRule |
## Rule Information
| | |
|----|----|
| Id | SRD0014 |
| Friendly Name | TOP without an ORDER BY |
| Category | Design |
| Ignorable | false |
| Applicable Types | Procedure |
| | Scalar Function |
| | Table Valued Function |
| | View |
## Description
TOP clause used in a query without an ORDER BY clause.
## Summary
TOP clause used in a query without an ORDER BY clause. Add order by clause to make selection predictable.
### Examples
```sql
CREATE PROCEDURE [dbo].[SelectTopNoParen]
AS
set nocount on;
Select top 100 Col1 from dbo.TestTableSSDT;
RETURN 0
-- SML034, SRD0014
```
### Remarks
This rule checks for usages of TOP in queries without an ORDER BY clause.
It is generally recommended to specify sort criteria when using TOP clause. Otherwise, the
results produced will be plan dependent and may lead to undesired behavior.
<sub><sup>Generated by a tool</sup></sub>