Home > SQL Trivia > SQL Trivia – What are Niladic functions in SQL Server?

SQL Trivia – What are Niladic functions in SQL Server?


 
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: ,
  1. No comments yet.
  1. April 12, 2016 at 7:49 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: