SELECT
OBJECT_SCHEMA_NAME(tt.type_table_object_id) AS SchemaName
, tt.name TableTypeName
FROM sys.table_types AS tt
JOIN sys.objects AS o ON
o.object_id = tt.type_table_object_id
WHERE tt.is_memory_optimized = 1;
您可以查询其他目录视图以获取其他元数据。例如,可以使用此查询列出列:
SELECT
OBJECT_SCHEMA_NAME(tt.type_table_object_id) AS SchemaName
, tt.name AS TableTypeName
, c.name AS ColumnName
, ty.name AS ColumnTypeName
, c.max_length AS ColumnLength
, c.is_nullable AS IsNullable
FROM sys.table_types AS tt
JOIN sys.objects AS o ON
o.object_id = tt.type_table_object_id
JOIN sys.columns AS c ON c.object_id = o.object_id
JOIN sys.types AS ty ON ty.system_type_id = c.system_type_id AND ty.user_type_id = c.user_type_id
WHERE tt.is_memory_optimized = 1
ORDER BY
SchemaName
, TableTypeName
, c.column_id;
下面的查询将识别当前数据库中的内存优化表类型。
您可以查询其他目录视图以获取其他元数据。例如,可以使用此查询列出列:
如果您需要包含索引、约束等的完整定义作为 DDL,请使用 SSMS 对象资源管理器或 PowerShell 编写类型脚本。
如果“uddts”是指内存优化表,那么以下查询将起作用:
对于定义,您可以使用 sp_helptext。