rspec/rules/S1172/tsql/rule.adoc

56 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2020-06-30 12:47:33 +02:00
include::../description.adoc[]
== How to fix it
2020-06-30 12:47:33 +02:00
include::../how-to-fix-it.adoc[]
=== Code examples
==== Noncompliant code example
[source,sql,diff-id=1,diff-type=noncompliant]
2020-06-30 12:47:33 +02:00
----
CREATE PROCEDURE SalesByCustomer
@CustomerName nvarchar(50) -- Noncompliant
AS
SELECT c.customer_name, sum(ctr.amount) AS TotalAmount
FROM customers c, contracts ctr
WHERE c.customer_id = ctr.customer_id
GROUP BY c.customer_name
ORDER BY c.customer_name
----
==== Compliant solution
2020-06-30 12:47:33 +02:00
[source,sql,diff-id=1,diff-type=compliant]
2020-06-30 12:47:33 +02:00
----
CREATE PROCEDURE SalesByCustomer
@CustomerName nvarchar(50)
AS
SELECT c.customer_name, sum(ctr.amount) AS TotalAmount
FROM customers c, contracts ctr
WHERE c.customer_id = ctr.customer_id
AND c.customer_name = @CustomerName
GROUP BY c.customer_name
ORDER BY c.customer_name
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]