home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 19,473 of 19,505   
   Anton Shepelev to All   
   Parameters with default values in functi   
   01 Mar 24 13:53:10   
   
   From: anton.txt@g{oogle}mail.com   
      
   Hello, all   
      
   MSSQL allows default values in parameters to functions:   
      
     CREATE FUNCTION test( @v INT = 1 )   
     RETURNS TABLE AS   
     RETURN  ( SELECT @v AS v )   
      
   but will not let me use them -- the invocation   
      
     SELECT * FROM test()   
      
   fails with:   
      
     An insufficient number of arguments were supplied for the   
     procedure or function test.   
      
   The documentation says it should work:   
      
     -- Transact-SQL Inline Table-Valued Function Syntax   
     CREATE [ OR ALTER ] FUNCTION [ schema_name. ] function_name   
     ( [ { @parameter_name [ AS ] [ type_schema_name. ] parameter_data_type [   
   NULL ]   
         [ = default ] [ READONLY ] }   
         [ ,...n ]   
       ]   
     )   
      
     The value of each declared parameter must be supplied by   
     the user when the function is executed, unless a default   
     for the parameter is defined.   
      
   What am I doing wrong on my MSSQL v. 13?   
      
   --   
   ()  ascii ribbon campaign -- against html e-mail   
   /\  www.asciiribbon.org   -- against proprietary attachments   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca