Skip to content
Tako Lee edited this page Mar 12, 2014 · 34 revisions

Parameter declaration

Parameter style
  • Fit into one line

    Option: fmt151_parameter_list_style = fit_into_one_line, type: TFmtListStyle.

    CREATE FUNCTION dbo.Fn_gettoporders(@custid AS INT,@n AS INT, @test AS CHAR)  
    RETURNS TABLE  
    AS  
      RETURN  
        SELECT TOP(@n) *  
        FROM   sales.salesorderheader  
        WHERE  customerid = @custid  
        ORDER  BY totaldue DESC  
    
    GO        
  • Stacked

    Option: fmt151_parameter_list_style = stacked, type: TFmtListStyle.

    CREATE FUNCTION dbo.Fn_gettoporders(
       @custid AS INT,
       @n AS INT, 
       @test AS CHAR)  
    RETURNS TABLE  
    AS  
      <function body>  
    GO        
    • Comma at the end of line

      Option: fmt152_parameter_list_comma_option = after_item, type: TFmtCommaOption.

      CREATE FUNCTION dbo.Fn_gettoporders(
         @custid AS INT,
         @n AS INT, 
         @test AS CHAR)  
      RETURNS TABLE  
      AS  
        <function body>  
      GO        
    • Comma at the begin of line

      Option: fmt152_parameter_list_comma_option = before_item, type: TFmtCommaOption.

      CREATE FUNCTION dbo.Fn_gettoporders(
         @custid AS INT
         ,@n AS INT 
         ,@test AS CHAR)  
      RETURNS TABLE  
      AS  
        <function body>  
      GO        
    • Comma at the begin of line, align parameters.

      Option: fmt152_parameter_list_comma_option = before_item_outside_list, type: TFmtCommaOption.

      CREATE FUNCTION dbo.Fn_gettoporders(
          @custid AS INT
         ,@n AS INT 
         ,@test AS CHAR)  
      RETURNS TABLE  
      AS  
        <function body>  
      GO        
    • Comma at the begin of line, align parameters, space between comma and space is 1 or n

      Option: fmt152_parameter_list_comma_option = before_item_outside_list_with_n_space, type: TFmtCommaOption.

      Option: fmt153_parameter_list_comma_space = n, type: int.

      CREATE FUNCTION dbo.Fn_gettoporders(
          @custid AS INT
         ,@n AS INT 
         ,@test AS CHAR)  
      RETURNS TABLE  
      AS  
        <function body>  
      GO        
  • Create function/procedure

  • IN and OUT keywords in parameter declaration

Parameter in function call
Clone this wiki locally