Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
noob
Starting Member
2 Posts |
Posted - 2009-02-05 : 10:32:06
|
| Hi, I just wanna ask how do you make a table structure using insert into? I know that SQL Server has select into, but I'm using insert into instead. Much like this statement: "SELECT * INTO #temp FROM Table" Considering that Table maybe any table from a database with distinct columns. And when using that with INSERT INTO, we need to create the table first.Can anybody help? Thank you. |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-02-05 : 10:40:44
|
| Any reason you want to use INSERT when you have the option of SELECT INTO? As far as I know, if you want to INSERT, you need to create that table structure separately before you do the insert. |
 |
|
|
noob
Starting Member
2 Posts |
Posted - 2009-02-05 : 10:49:11
|
quote: Originally posted by vijayisonly Any reason you want to use INSERT when you have the option of SELECT INTO? As far as I know, if you want to INSERT, you need to create that table structure separately before you do the insert.
I'm actually experimenting with VistaDB right now, and they don't have support for SELECT INTO. That's what I know too. But the problem the Table is dynamic, it could be any table from my database. Can you suggest any workarounds?Thank you. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-05 : 12:41:05
|
| then you need dynamic sql. based on table, you need to get metadata info from information_schema views and use it to generate new table using dynamic sql |
 |
|
|
|
|
|