Search notes:

SQL Server: sys.sql_modules

sys.sql_modules stores the definition of object that are defined with SQL (such as a view or a stored procedure).
select
   sch.name          sch,
   obj.name          obj_name,
   obj.type          obj_type,
-- obj.type_desc     obj_type_desc,
   mod.definition    mod_definition,
   obj.modify_date   obj_mod_dt,
   obj.object_id     obj_id
from
   sys.objects       obj                                   join
   sys.sql_modules   mod on obj.object_id = mod.object_id  join
   sys.schemas       sch on obj.schema_id = sch.schema_id
where
   lower(obj.name) = 'tq84_ect' and
   lower(sch.name) = 'dbo'
-- object_id = object_id('nameOfObject');  
;
TODO 2024-02-22: there are stored procedures whose definitions are null if selected with this statement.

See also

Showing object definitions
The sys schema.

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...', 1737520448, '3.133.156.254', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQL-Server/administration/schemas/sys/objects/views/sql_modules/index(61): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78