July 31, 2006 at 8:46 am
Hi there,
I've been searching everywhere for this, but can't seem to find something I can use. Thought I'll ask you guys!!
We are busy developing an application that creates tables on the fly. the application takes an external datasource & imports this into a SQL database. Data comes from various sources & have different columns.
The application then tries to create another table based on the columns in the "import table", if I can call it that. The final table that needs to be created, depends on data & source, so no table will be the same.
Doing this seems more difficult than anticipated. I know of the setting to only return metadata...
SET FMTONLY ON.
The problem we face here is that you can't do anything with that result set, so it means nothing.
Does anyone know how I can return only column names from a table, but be able to use it?
Regards & thanks in advance!!
T.
July 31, 2006 at 9:11 am
SELECT * FROM syscolumns where id=object_id('dbo.yourtable')
August 1, 2006 at 8:22 pm
August 5, 2006 at 1:27 pm
what are you using to develop the application? You might want to try using ADOX. It's supported by the SQL Server ADO provider.
August 7, 2006 at 1:34 pm
Tobie,
I am not sure I follow you. Are you saying you want to create a table, then get its schema loaded into a result set so that you can use that result set to add rows to the table?
How about ....
SELECT Top 0 * from table
What this will do is it will return a zero-row record set with the schema filled out as if you returned several rows.
I am Doing it with .Net, are you?
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply