来自 SQL 服务器的列名

Column Names from SQL Server

我试图在 SQL 服务器中获取我的 table 的列名,但没有成功。

我尝试了以下方法:

SELECT * FROM [myDB].INFORMATION_SCHEMA.COLUMNS where [TABLE_NAME] = N'myTable'
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='myTable'

SELECT COLUMN_NAME , * 
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'myTable' AND TABLE_SCHEMA='dbo'

SELECT [name] AS [Column Name]
FROM syscolumns
WHERE id = (SELECT id FROM sysobjects WHERE  [Name] = 'myTable')

SELECT c.name FROM sys.columns c
INNER JOIN sys.tables t 
ON t.object_id = c.object_id
AND t.name = 'myTable'

正在 returned 的是,我认为是 table.

的元数据

而实际上实际的列名是:

如何 return 来自 'myTable' 的列名?

此解决方案返回了我正在寻找的列表

SELECT name 
FROM   sys.columns 
WHERE  object_id = Object_id('myTable')