Skip to content

SQL Server declare statement

Tako Lee edited this page Apr 9, 2014 · 3 revisions
  • Variables fit into same line

    Option: fmt163_mssql_declare_variables_style = fit_into_one_line, type: TFmtListStyle.

    • First variable in the same line as DECLARE keyword

      Option: fmt164_mssql_declare_variables_in_newline = false, type: TFmtBoolean.

      DECLARE @s VARCHAR(1000),@s2 VARCHAR(10)  
    • First variable in new line, indented by 0 or n

      Option: fmt164_mssql_declare_variables_in_newline = true, type: TFmtBoolean.

      Option: fmt165_mssql_declare_variables_indent = n, type: int.

      DECLARE 
        @s VARCHAR(1000),@s2 VARCHAR(10)  
  • Stacked variables

    Option: fmt163_mssql_declare_variables_style = stacked, type: TFmtListStyle.

    • First variable in the same line as DECLARE keyword

      • Comma at the end of line

        DECLARE @s VARCHAR(1000),
                @s2 VARCHAR(10)  
      • Comma at the begin of line

        DECLARE @s VARCHAR(1000)
                ,@s2 VARCHAR(10)  
      • Comma at the begin of line, align variables.

        DECLARE @s VARCHAR(1000)
               ,@s2 VARCHAR(10)  
      • Comma at the begin of line, align variables, space between comma and variable is 1 or n.

        Option: fmt166_mssql_declare_variables_comma_option = before_item_outside_list_with_n_space, type: TFmtCommaOption.

        Option: fmt167_mssql_declare_variables_comma_space = n, type: int.

        DECLARE @s VARCHAR(1000)
              , @s2 VARCHAR(10)  
    • First variable in new line, indented by 0 or n

      • Comma at the end of line

        DECLARE 
          @s VARCHAR(1000),
          @s2 VARCHAR(10)  
      • Comma at the begin of line

        DECLARE 
          @s VARCHAR(1000)
          ,@s2 VARCHAR(10)  
      • Comma at the begin of line, align variables.

        DECLARE 
           @s VARCHAR(1000)
          ,@s2 VARCHAR(10)  
      • Comma at the begin of line, align variables, space between comma and variable is 1 or n.

        DECLARE 
            @s VARCHAR(1000)
          , @s2 VARCHAR(10)  
Clone this wiki locally