SAP Knowledge Base Article - Public

1214495 - How to display the user name or database logon in Crystal Reports?

Symptom

  • How to show the database user name on a report?
  • In Crystal Reports, how do you add the user name or database logon to the report?
  • The database does not include a field containing the user name or database logon.  Also, Crystal Reports does not include a special field containing the user name or database logon. How can you add the user name or database logon to display on the report?

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020

Resolution

  • To add the user name or database logon on the report, creatie an SQL Expression field that contains the user name function, and place the SQL Expression field on the report.
      
  • The SQL Expression field requires database-specific syntax for the user name function. The correct user name function varies depending on the database type and the connection type used in the report. Also, the user name function is not available for all database types. Consult the Help files of your database to determine if the user name function is available, or contact your Database Administrator.  
      
    • Microsoft SQL Server
      • Connection type: ODBC
      • Syntax: suser_sname()
           
    • Oracle
      • Connection type: ODBC, native, OLE DB
      • Syntax: user
           
    • DB2
      • Connection type: ODBC, native, OLE DB
      • Syntax: user
           
    • Sybase
      • Connection type: native
      • Syntax: suser_name()
            
      • Connection type: ODBC
      • Syntax: {fn USER()}
            
    • Pervasive
      • Connection type: ODBC
      • Syntax: {fn USER()}
           
    • Informix
      • Connection type: ODBC, native
      • Syntax: user
         
  • Upon creating a SQL Expression field that contains the correct database-specific syntax and placing it on the report, you will successfully display the user name or database logon on the report.

Keywords

SMI LOG ON LOGIN IN DISPLAY SHOW USER ID DATABASE ADD SQL EXPRESSION FORMULA Crystal Reports Displaying the user ID on a report Database functions Logon information , c2010985 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020