Archive

Archive for March 30, 2016

SQL Trivia – What are Niladic functions in SQL Server?

March 30, 2016 1 comment

 
Niladic functions are functions that do not accept any parameters, are specified without parentheses, and return only one result.
 

Following is the list of Niladic functions:

Niladic function (SQL-92)

Value returned
CURRENT_TIMESTAMP Current date and time.
CURRENT_USER Name of user performing an insert.
SESSION_USER Name of user performing an insert.
SYSTEM_USER Name of user performing an insert.
USER Name of user performing an insert.

 

Execution of below query with these functions gives following results:

SELECT 
	 CURRENT_TIMESTAMP AS 'CURRENT TIMESTAMP'
	,CURRENT_USER AS 'CURRENT USER'
	,SESSION_USER AS 'SESSION USER'
	,SYSTEM_USER AS 'SYSTEM USER'
	,USER AS 'USER'

Niladic functions


Advertisement
Categories: SQL Trivia Tags: ,