Quote:
Originally posted by kfenstad
is this possible? i can do it from a table...
oServer.Databases.Item(sDatabase).Tables.Item(sTab le).Columns.Item(iLoop).Name
but i also need the names of columns from a view, so...
oServer.Databases.Item(sDatabase).Views.Item(sView ). ???
any help would be much appreciated, thank you!!!
|
so... i figured out my own problem but i thought i would post it here in case anyone else would like to get view column info... which would be quite a coincidence! anyway...
i just linked to the system tables in sql server where my view is, and then created a recordset.
Set rsViewColumns = CurrentDb.OpenRecordset("SELECT dbo_syscolumns.name FROM dbo_sysobjects INNER JOIN dbo_syscolumns " _
& "ON dbo_sysobjects.id = dbo_syscolumns.id WHERE dbo_sysobjects.name = '" & sView & "'")
if "sView" is a string containing the name of the view, you get a recordset of all the column names. you also can get other info such as if the column is nullable or join the systypes table as well and get info about the column datatype. pretty easy!
