如何使用SQL在Access中的表中列出字段名称

如果可以列出MS Access表中的所有字段名称,请告诉我吗?

谢谢

解决方法

我在ms访问太多了.

我知道这样做的唯一方法是使用vba,并定义例如记录集,并循环遍历字段.

例如:

dim rst as new adodb.recordset
rst.open "SELECT * FROM SoMetable",CurrentProject.Connection,adOpenForwardOnly,adLockReadOnly
' Note: adOpenForwardOnly and adLockReadOnly are the default values '
' for the CursorType and LockType arguments,so they are optional here '
' and are shown only for completeness '

dim ii as integer
dim ss as string
for ii = 0 to rst.fields.count - 1
    ss = ss & "," & rst.fields(ii).name
next ii

字符串变量ss将包含名为“SoMetable”的表中所有列名的逗号分隔列表.

通过稍微重新格式化逻辑,您应该能够将此数据插入到另一个表中,然后查询它.

这有帮助吗?

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...