gpt4 book ai didi

sql-server - 获取表列的创建日期

转载 作者:行者123 更新时间:2023-12-05 08:02:20 25 4
gpt4 key购买 nike

我找到了一个获取列信息的脚本:

SELECT 
crdate as thisFieldIsNotTheCreationOfTheField1 ,
refdate as thisFieldIsNotTheCreationOfTheField2 ,
o.name AS [TableName],
o.type,
c.name AS [ColName],
s.name AS [ColType],
c.prec,
c.scale,
c.isnullable
FROM
dbo.sysobjects AS o
INNER JOIN
dbo.syscolumns AS c ON c.id = o.id
INNER JOIN
dbo.systypes AS s ON c.xtype = s.xtype
WHERE
o.type = 'U' and o.name='TableNa'
ORDER BY
crdate

未找到列创建日期时间。

如何做到这一点?

最佳答案

这就是你想要的:

SELECT obj.create_date 
from sys.objects obj
inner join sys.columns col on obj.object_Id=col.object_Id
WHERE col.name = @columnName
and obj.Name=@tableName

关于sql-server - 获取表列的创建日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7932315/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com