SQL Server - Return SCHEMA for sysobjects

后端 未结 8 1433
旧巷少年郎
旧巷少年郎 2020-12-29 21:30

How to I get the SCHEMA when doing a select on sysobjects?

I am modifing a stored procedure called SearchObjectsForText which returns only the Name

8条回答
  •  無奈伤痛
    2020-12-29 22:10

    In SQL 200:

    select DISTINCT
      name            as  ObjectName,     
      USER_NAME(uid)  as  SchemaName
    from 
      sysobjects
    

    In earlier releases of SQL Server, databases could contain an entity called a "schema", but that entity was effectively a database user.

提交回复
热议问题