sysobjects or sys.objects

  • I am trying to run the following query on SQL Server 2008 R2:

    USE MyDB;

    GO

    SELECT name AS procedure_name

    ,SCHEMA_NAME(schema_id) AS schema_name

    ,type_desc

    ,create_date

    ,modify_date

    FROM sys.procedures;

    GO

    And the error is Invalid object name 'sys.procedures'.

    Pl can someone advice on how to make the above query work in SQL Server 2008 R2.?

    Also when I try to run SELECT * FROM sys.objects

    It also gives me the error saying Invalid object name 'sys.objects'

    But when I run this query SELECT * FROM sysobjects

    It works.

    Is it sys.object or sysobject.?

    Pl can someone advise on these 2 queries?

    And also how to

  • Please run the following and post the results

    SELECT @@Version

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Gail,

    My mistake,I was running the query on SQL Server 2000.

    Thanks and Regards

  • Thought as much. On SQL 2000 use sysobjects. On 2005 and above, it is sys.procedures and sys.objects.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply