Search code examples
sqlsql-serverlucee

Issues with the view of SQL Server


I am running this query

select owner, recovery, status, collation, version 
from vw_db_info 
where name = 'test100'

And I get this error:

Error Executing Database Query.
Invalid object name 'vw_db_info'.

Is there another way I get the same information without that above and I seemingly not found the view in database, not in system.


Solution

  • There is no definition of your custom view vw_db_info so at a guess, maybe this is what you want:

    select 
    p.Name, 
    D.recovery_model_desc, 
    D.state_desc, 
    D.collation_name, 
    D.compatibility_level, 
    @@VERSION
    from sys.databases D
    left outer JOIN
    SYS.server_principals p
    on d.owner_sid = p.principal_id
    where D.name = 'TEST100'