Learn T-SQL Commands with Samples
Skip Navigation Links
Skip Navigation Links.
Expand DatabaseDatabase
Expand TableTable
Expand ViewView
Expand Stored ProcedureStored Procedure
Expand Data FilteringData Filtering
Expand Data GroupingData Grouping
Expand JoinsJoins
Expand TriggerTrigger
Expand CursorCursor
Expand OperatorsOperators
Expand ConstraintsConstraints
Collapse FunctionsFunctions
Expand Conditional ProcessingConditional Processing
Expand LoopingLooping
Expand Error HandlingError Handling
Expand v.IMP Queriesv.IMP Queries
Expand XMLXML
Expand Query PerformanceQuery Performance
Expand QueriesQueries
Expand NormalizationNormalization
Expand CreateCreate
     

System Functions

 
SELECT

      HOST_NAME()     as	'HOST_NAME',
      HOST_ID()       as	'HOST_ID',
      USER_NAME(2)    as	'USER_NAME(2)',
      USER_NAME()     as	'USER_NAME',
      CURRENT_USER    as	'CURRENT_USER',
      @@ROWCOUNT      as	'@@ROWCOUNT'
    
      
Output
HOST_NAME HOST_ID USER_NAME(2) USER_NAME CURRENT_USER @@ROWCOUNT
FiLastName 6172 guest dbo dbo 1