From 0d0b0b4356ee8413ef7e9bb859342e76f3bd428e Mon Sep 17 00:00:00 2001 From: sevin7676 Date: Sat, 18 Apr 2015 08:45:13 -0400 Subject: [PATCH] updated demo doc and snippets --- demo/kitchen-sink/docs/sqlserver.sqlserver | 16 ++++++++++++--- lib/ace/snippets/sqlserver.snippets | 24 +++++++++++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/demo/kitchen-sink/docs/sqlserver.sqlserver b/demo/kitchen-sink/docs/sqlserver.sqlserver index cf747864..5898fada 100644 --- a/demo/kitchen-sink/docs/sqlserver.sqlserver +++ b/demo/kitchen-sink/docs/sqlserver.sqlserver @@ -4,6 +4,7 @@ -- Description: Test Procedure that shows off language features. -- Includes non-standard folding using region comments using either -- line comments or block comments (both are demonstrated below) +-- This mode imitates SSMS and it designed to be used with SQL Server theme. -- ============================================= CREATE PROCEDURE dbo.TestProcedure @@ -27,20 +28,29 @@ BEGIN * These comments will produce a fold widget */ + -- folding demonstration SET @vint = CASE WHEN @vdate IS NULL THEN 1 ELSE 2 END - - + + -- another folding demonstration IF @vint = 1 BEGIN SET @vvarchar='one' SET @vint = DATEDIFFT(dd, @vdate, @vdatetime) END - + -- this mode handles strings properly + DECLARE @sql nvarchar(4000) = N'SELECT TOP(1) OrderID + FROM Orders + WHERE @OrderDate > GETDATE()' + + -- this mode is aware of build in stored procedures + sp_executesql @sql + + -- demonstrating some syntax highlighting SELECT Orders.OrderID ,Customers.CompanyName ,DATEFROMPARTS(YEAR(GETDATE()), 1, 1) AS FirstDayOfYear diff --git a/lib/ace/snippets/sqlserver.snippets b/lib/ace/snippets/sqlserver.snippets index 97c197dc..51c00ae4 100644 --- a/lib/ace/snippets/sqlserver.snippets +++ b/lib/ace/snippets/sqlserver.snippets @@ -15,7 +15,7 @@ snippet datepart DATEPART(${1:datepart}, ${2:date}) # DATEDIFF snippet datediff - DATEDIFFT(${1:datepart}, ${2:startdate}, ${3:enddate}) + DATEDIFF(${1:datepart}, ${2:startdate}, ${3:enddate}) # DATEADD snippet dateadd DATEADD(${1:datepart}, ${2:number}, ${3:date}) @@ -33,10 +33,24 @@ snippet createproc -- Add the parameters for the stored procedure here AS BEGIN - -- SET NOCOUNT ON added to prevent extra result sets from - -- interfering with SELECT statements. + -- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements. SET NOCOUNT ON; - - -- Insert statements for procedure here + END GO +# Create Scalar Function +snippet createfn + -- ============================================= + -- Author: ${1:Author} + -- Create date: ${2:Date} + -- Description: ${3:Description} + -- ============================================= + CREATE FUNCTION ${4:Scalar_Function_Name} + -- Add the parameters for the function here + RETURNS ${5:Function_Data_Type} + AS + BEGIN + DECLARE @Result ${5:Function_Data_Type} + + END + GO \ No newline at end of file