ace/lib/ace/snippets/sqlserver.snippets
2015-04-18 08:45:13 -04:00

56 lines
No EOL
1.4 KiB
Text

# ISNULL
snippet isnull
ISNULL(${1:check_expression}, ${2:replacement_value})
# FORMAT
snippet format
FORMAT(${1:value}, ${2:format})
# CAST
snippet cast
CAST(${1:expression} AS ${2:data_type})
# CONVERT
snippet convert
CONVERT(${1:data_type}, ${2:expression})
# DATEPART
snippet datepart
DATEPART(${1:datepart}, ${2:date})
# DATEDIFF
snippet datediff
DATEDIFF(${1:datepart}, ${2:startdate}, ${3:enddate})
# DATEADD
snippet dateadd
DATEADD(${1:datepart}, ${2:number}, ${3:date})
# DATEFROMPARTS
snippet datefromparts
DATEFROMPARTS(${1:year}, ${2:month}, ${3:day})
# Create Procedure
snippet createproc
-- =============================================
-- Author: ${1:Author}
-- Create date: ${2:Date}
-- Description: ${3:Description}
-- =============================================
CREATE PROCEDURE ${4:Procedure_Name}
-- 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;
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