corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 -- =============================================
2 -- Author: Morgan Yarbrough
3 -- Create date: 4/27/2015
4 -- Description: Test procedure that shows off language features.
5 -- Includes non-standard folding with region comments using either
6 -- line comments or block comments (both are demonstrated below).
7 -- This mode imitates SSMS and it designed to be used with SQL Server theme.
8 -- =============================================
9 CREATE PROCEDURE dbo.TestProcedure
10  
11 --#region parameters
12 @vint INT = 1
13 ,@vdate DATE = NULL
14 ,@vdatetime DATETIME = DATEADD(dd, 1, GETDATE())
15 ,@vvarchar VARCHAR(MAX) = ''
16 --#endregion
17  
18 AS
19 BEGIN
20  
21 /*#region set statements */
22 SET NOCOUNT ON;
23 SET XACT_ABORT ON;
24 SET QUOTED_IDENTIFIER ON;
25 /*#endregion*/
26  
27 /**
28 * These comments will produce a fold widget
29 */
30  
31 -- folding demonstration
32 SET @vint = CASE
33 WHEN @vdate IS NULL
34 THEN 1
35 ELSE 2
36 END
37  
38 -- another folding demonstration
39 IF @vint = 1
40 BEGIN
41 SET @vvarchar = 'one'
42 SET @vint = DATEDIFF(dd, @vdate, @vdatetime)
43 END
44  
45 -- this mode handles strings properly
46 DECLARE @sql NVARCHAR(4000) = N'SELECT TOP(1) OrderID
47 FROM Orders
48 WHERE @OrderDate > GETDATE()'
49  
50 -- this mode is aware of built in stored procedures
51 EXECUTE sp_executesql @sql
52  
53 -- demonstrating some syntax highlighting
54 SELECT Orders.OrderID
55 ,Customers.CompanyName
56 ,DATEFROMPARTS(YEAR(GETDATE()), 1, 1) AS FirstDayOfYear
57 FROM Orders
58 INNER JOIN Customers
59 ON Orders.CustomerID = Customers.CustomerID
60 WHERE CompanyName NOT LIKE '%something'
61 OR CompanyName IS NULL
62 OR CompanyName IN ('bla', 'nothing')
63  
64 -- this mode includes snippets
65 -- place your cusor at the end of the line below and trigger auto complete (Ctrl+Space)
66 createpr
67  
68 -- SQL Server allows using keywords as object names (not recommended) as long as they are wrapped in brackets
69 DATABASE -- keyword
70 [DATABASE] -- not a keyword
71  
72 END