Tuesday, February 14, 2012

Database List for the currently logged in user

I can get a list of all databases in SQL Server using

sqlText = "select name from sysdatabases order by name".

How can I get such a list for the currently logged in user only?

Thanks in advance

Harold HoffmanI found it.

select name from sysdatabases where HAS_DBACCESS(name) = 1 order by name

Harold Hoffman

No comments:

Post a Comment