在 SSMS 中,我使用以下脚本创建了一个数据库。当脚本执行完成时,我希望在sql_modules表中看到 CREATE TABLE 语句。但是我找不到它。
CREATE DATABASE [MyDb]
GO
USE [MyDb]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[MyTable] (
[UID] [uniqueidentifier] NOT NULL,
[DateTime] [datetime] NOT NULL
)
这是我运行获取表定义的查询。但是,我得到三个空结果集。知道为什么我会得到这三个空结果集吗?
USE MyDb
GO
SELECT *
FROM sys.sql_modules
SELECT *
FROM sys.triggers
SELECT sm.object_id, OBJECT_NAME(sm.object_id) AS object_name, o.type, o.type_desc, sm.definition
FROM sys.sql_modules AS sm
JOIN sys.objects AS o ON sm.object_id = o.object_id
ORDER BY o.type;