I never remember if a system T-SQL function, with no parameters, requires parenthesis, so I wonder if there is a reason.
For example: CURRENT_TIMESTAMP is a function that doesn't require parenthesis, while SCOPE_IDENTITY() requires them.
How to Create a Function Without a Parameter in SQL. Line one creates a function then named the function “YTDSALES()”. You can give your function any name. Remember to add parenthesis to the name of the function when without a parameter.
Scalar-valued functions can be executed by using the EXECUTE statement. If you EXECUTE a function rather than use it in a SELECT statement or constraint, you can leave out the schema name in the function name, and it will look in the dbo schema followed by the users default schema.
I think the differences are due to whether the function is a part of the ansi sql standard (which current_timestamp is) or whether it is a sql server function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With