What is a SQL Server module?

前端 未结 4 1239
日久生厌
日久生厌 2021-01-19 01:54

I just came across the system view sys.sql_modules today. What is a module versus a DB object? The view returns, most prominently, a column containing the def

4条回答
  •  醉梦人生
    2021-01-19 02:43

    A module, in SQL-Server-speak is a stand-alone object that contains sql batches, such as a view, table valued function, stored procedure, trigger or scalar function. A SQL object is a more all-encompassing term that includes some that contain SQL Expressions, such as check or default constraints. A module used to be referred to as a 'routine' before SQL Server 2005, but I think the two terms are used interchangeably.

    The table build script is not stored in SQL Server because of the ease with which components of a table can be altered separately. Therefore it is treated as an object but not a module.
    Typical objects that aren't also considered to be modules are system tables, default constraints, foreign key constraints, service queues, check constraints, user tables, primary key constraints, internal tables and unique constraints.

    Columns aren't considered to be objects. Neither are indexes.

    Yes, it is all more complex than one might first think.

提交回复
热议问题