Search notes:

SQL Server: comparison of object views

There are four views in the sys schema that seem to be able to query about objects in a database:

Compare the definitions of these views

The following script allows to compare the definitions of these four views:
--
-- Setting sqlcmdmaxvartypewidth to 0 so as to not limit
-- the number of characters that are returned by object_definition().
-- This scripting variable could also be set with sqlcmd's option -y.
--
:setvar sqlcmdmaxvartypewidth 0


print "sys.all_objects"   ; select object_definition(object_id('sys.all_objects'   ))
print "sys.objects"       ; select object_definition(object_id('sys.objects'       ))
print "sys.sysobjects"    ; select object_definition(object_id('sys.sysobjects'    ))
print "sys.system_objects"; select object_definition(object_id('sys.system_objects'))
Github repository about-MSSQL, path: /administration/schemas/sys/objects/views/comparison-object-views.sql

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1738292469, '18.116.38.30', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQL-Server/administration/schemas/sys/objects/views/_object_views(53): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78