sqlserver.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ace.define("ace/snippets/sqlserver",["require","exports","module"], function(require, exports, module) {
  2. "use strict";
  3. exports.snippetText = "# ISNULL\n\
  4. snippet isnull\n\
  5. ISNULL(${1:check_expression}, ${2:replacement_value})\n\
  6. # FORMAT\n\
  7. snippet format\n\
  8. FORMAT(${1:value}, ${2:format})\n\
  9. # CAST\n\
  10. snippet cast\n\
  11. CAST(${1:expression} AS ${2:data_type})\n\
  12. # CONVERT\n\
  13. snippet convert\n\
  14. CONVERT(${1:data_type}, ${2:expression})\n\
  15. # DATEPART\n\
  16. snippet datepart\n\
  17. DATEPART(${1:datepart}, ${2:date})\n\
  18. # DATEDIFF\n\
  19. snippet datediff\n\
  20. DATEDIFF(${1:datepart}, ${2:startdate}, ${3:enddate})\n\
  21. # DATEADD\n\
  22. snippet dateadd\n\
  23. DATEADD(${1:datepart}, ${2:number}, ${3:date})\n\
  24. # DATEFROMPARTS \n\
  25. snippet datefromparts\n\
  26. DATEFROMPARTS(${1:year}, ${2:month}, ${3:day})\n\
  27. # OBJECT_DEFINITION\n\
  28. snippet objectdef\n\
  29. SELECT OBJECT_DEFINITION(OBJECT_ID('${1:sys.server_permissions /*object name*/}'))\n\
  30. # STUFF XML\n\
  31. snippet stuffxml\n\
  32. STUFF((SELECT ', ' + ${1:ColumnName}\n\
  33. FROM ${2:TableName}\n\
  34. WHERE ${3:WhereClause}\n\
  35. FOR XML PATH('')), 1, 1, '') AS ${4:Alias}\n\
  36. ${5:/*https://msdn.microsoft.com/en-us/library/ms188043.aspx*/}\n\
  37. # Create Procedure\n\
  38. snippet createproc\n\
  39. -- =============================================\n\
  40. -- Author: ${1:Author}\n\
  41. -- Create date: ${2:Date}\n\
  42. -- Description: ${3:Description}\n\
  43. -- =============================================\n\
  44. CREATE PROCEDURE ${4:Procedure_Name}\n\
  45. ${5:/*Add the parameters for the stored procedure here*/}\n\
  46. AS\n\
  47. BEGIN\n\
  48. -- SET NOCOUNT ON added to prevent extra result sets from interfering with SELECT statements.\n\
  49. SET NOCOUNT ON;\n\
  50. \n\
  51. ${6:/*Add the T-SQL statements to compute the return value here*/}\n\
  52. \n\
  53. END\n\
  54. GO\n\
  55. # Create Scalar Function\n\
  56. snippet createfn\n\
  57. -- =============================================\n\
  58. -- Author: ${1:Author}\n\
  59. -- Create date: ${2:Date}\n\
  60. -- Description: ${3:Description}\n\
  61. -- =============================================\n\
  62. CREATE FUNCTION ${4:Scalar_Function_Name}\n\
  63. -- Add the parameters for the function here\n\
  64. RETURNS ${5:Function_Data_Type}\n\
  65. AS\n\
  66. BEGIN\n\
  67. DECLARE @Result ${5:Function_Data_Type}\n\
  68. \n\
  69. ${6:/*Add the T-SQL statements to compute the return value here*/}\n\
  70. \n\
  71. END\n\
  72. GO";
  73. exports.scope = "sqlserver";
  74. });