Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make table from recordset 1

Status
Not open for further replies.

RiverGuy

Programmer
Jul 18, 2002
5,011
US
I have a recordset that I get from one data source. What I would like to be able to do is a SELECT INTO or something to make a table out of it in SQL Server. Would this be possible?
 
To make a new table in SQL you would need to run a Create Table SQL statement. You would need the properties of each column from the recordsource and then pass them into your SQL statement (Type and size would do). You also need to be careful with your datatypes because certain fields may be created as numeric when they may actually be doubles, singles etc.
 
I actually decided to make a stationary table and delte the data when I'm done with it.

Oh, ok, I should have realized. You're saying insert each column in the recordset, like rst![column1]. That makes sense. In my haste, I had got frustrated and made arrays for each column and assigned the data to arrays. I think I will change it to your way.
 
This maybe a simpler solution...

Dim dbQry as database

dbQry.Execute "SELECT * INTO newtable FROM table1"


Just make sure that newtable doesn't exist.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top