Hello!
I'd like to be able to find out, programmatically, what field names are there in a particular table. I use JScript and an MS Access database.
Also, if possible, if there is a particular table in the database.
And to do it so that no error message is generated.
Is there a way in SQL? I spent considerable time looking for an SQL syntax for that query, without any success.There is a MS Access forum on this site. The below should help you out:
http://www.dbforums.com/showthread.php?threadid=755288&highlight=column+names
Originally posted by masha
Hello!
I'd like to be able to find out, programmatically, what field names are there in a particular table. I use JScript and an MS Access database.
Also, if possible, if there is a particular table in the database.
And to do it so that no error message is generated.
Is there a way in SQL? I spent considerable time looking for an SQL syntax for that query, without any success.|||Originally posted by dmmac
There is a MS Access forum on this site. The below should help you out:
http://www.dbforums.com/showthread.php?threadid=755288&highlight=column+names
Thank you very much! That solves it indeed.
Sorry for posting in this forum. I did it because I hoped that it were possible using pure SQL.
Thanks again!sql
Showing posts with label programmatically. Show all posts
Showing posts with label programmatically. Show all posts
Monday, March 26, 2012
How to index through columns
How do you index through a set of Columns Programmatically using SQL. I have a Table all the columns have the same data for different dates. Column names are Col_0, Col_1, Col_2,....Col_100, Col_101. I need to perform the same calculation on each column to manipulate the data into a different table. Is it possible to do a While loop that changes the Column name in a SELECT statement. I have tried to do this but can't seem to get it to work. Please help !
You could set up a cursor using syscolumns.
Run this in QA after changing the table name:
select colid, name
from syscolumns
where id = (
select id
from sysobjects
where name = 'MyTableName')
order by colid
That should give you an idea of how to use that. You can dynamically build SQL using your cursor and execute it. There may be something more elegant, but I've used this successfully in the past.
|||Thank PDraigh I will try it
Subscribe to:
Posts (Atom)