-->

Wednesday, January 8, 2014

System Functions used to Query System Tables in Sql Server: SQL Programming

System Functions used to Query System Tables in Sql Server: SQL Programming

In SQL Programming, system functions are used to query on system tables. Programmer can easily perform all type of system functions to generate sequential numbers for each row based on specific criteria.

The system functions are used to query the system tables. System tables are a set of tables that are used by the SQL Server to store information about users, databases, tables and security. The system functions are used to access the SQL Server databases or user-related information. For example, to view the host ID of the terminal on which you are logged onto, you can use the following query:

SELECT host_id ( )

The following table lists the system function provided by SQL Server

  • host_id (), Returns the current host process ID number of a client process
  • host_name (), Returns the current host computer name of a client process
  • suser_sid ([‘login_name’]), Returns the security identification (SID) number corresponding to the log on name of the user
  • suser_id ([‘login_name’]), Returns the log on identification (ID) number corresponding to the log on name of the user
  • suser_sname ([server_user_id]), Returns the log on name of the user corresponding to the security identification number
  • user_id ([‘name_in_db’]), Returns the database identification number corresponding to the user name
  • user_name ([user_id]), Returns the user name corresponding to the database identification number
  • db_id ([‘db_name’]), Returns the database identification number of the database
  • db_name ([db_id]), Returns the database name
  • object_id (‘objname’), Returns the database object ID number
  • object_name (‘obj_id), Returns the database object name


Read other related articles

Also read other articles

© Copyright 2013 Computer Programming | All Right Reserved