updated demo doc and snippets

This commit is contained in:
sevin7676 2015-04-18 08:45:13 -04:00
commit 0d0b0b4356
2 changed files with 32 additions and 8 deletions

View file

@ -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

View file

@ -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