A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z  special characters  sybase-tech-blog


Category: ASE: Functions: User, Login and Role Functions

valid_user()

The user function valid_user() determines, if the user identification number specified in the parameter "user_id", belongs to a valid user or alias in at least one database. The function can only be executed for the current user's own "suid". To check other "suids", System Administrators or System Security Officers privileges are needed.

Syntax of the User Function valid_user()

    valid_user([server_user_id])
    

The parameter of the User Function valid_user()

server_user_id
The parameter "server_user_id" is a placeholder for an arbitrary "suid" of a database user or alias in a database. The "server_user_id" is the "suid" stored in the system table syslogins. The function valid_user() compares this "suid" with entries in the system tables sysusers and sysalternates. If the "server_user_id" is found in one of the two system tables (sysusers, sysalternates) in at least one database, the functions returns "1"; if not, "0" is returned.

Example for the User Function user

    select valid_user(153)
go
-----
1

Returns the value "1", because the user with the "server_user_id" 153 is a valid user in at least one database.

See also:
has_role(),
proc_role(),
mut_excl_roles(),
role_contain(),
role_id(),
role_name(),
show_role(),
setuser,
sp_addalias,
sp_addgroup,
sp_addlogin,
sp_adduser,
sp_changegroup,
sp_configure "check password for digit",
sp_configure "minimum failed logins",
sp_configure "minimum password length",
sp_configure "systemwide password expiration",
sp_displaylogin,
sp_dropalias,
sp_dropgroup,
sp_droplogin,
sp_dropuser,
sp_helpgroup,
sp_helpuser,
sp_locklogin,
sp_modifylogin,
sp_password,
suser_id(),
suser_name(),
user,
user_id(),
user_name() and
Functions.

See also:

ASE T-SQL - Aggregate Functions,
ASE T-SQL - User,
mut_excl_roles(),
proc_role(),
role_contain(),
role_id(),
role_name(),
show_role(),
suser_id(),
suser_name(),
user,
user_id(),
user_name(),
valid_name().