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 |
|
groston
Yak Posting Veteran
61 Posts |
Posted - 2005-01-17 : 10:10:14
|
| I suspect that this is REALLY easy, but I haven't figured it out.What I would like to do is this:CREATE TABLE #tmpTableINSERT #tmpTableSELECT *FROM myTableWHERE <condition is true>The part that I am missing is in the CREATE TABLE. I would like the same column definitions in the temporary table as in the permanent table and (obviously) I do not want to specify them by hand.How do I accomplish this?thank you. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-01-17 : 10:17:21
|
SELECT *INTO #tmpTableFROM myTableWHERE <condition is true>Go with the flow & have fun! Else fight the flow |
 |
|
|
Xerxes
Aged Yak Warrior
666 Posts |
Posted - 2005-01-17 : 10:22:31
|
| Couldn't you just drop the table you're using when you're done?~~~~~~~~~~~~~Semper fi, Xerxes, USMC |
 |
|
|
JimL
SQL Slinging Yak Ranger
1537 Posts |
Posted - 2005-01-17 : 16:12:19
|
| How about makeing it easy.SELECT *Into #tmpTableFROM myTableWHERE <condition is true>Sorry Spirit I jumpped past your post.JimUsers <> Logic |
 |
|
|
groston
Yak Posting Veteran
61 Posts |
Posted - 2005-01-17 : 16:39:46
|
Thanks all - I knew it had to be easy - but this easy? Makes me look less competent than I am |
 |
|
|
Xerxes
Aged Yak Warrior
666 Posts |
Posted - 2005-01-26 : 18:21:21
|
| Hey groston, I also ask questions here all the time. Some of them make it seem like I couldn't spell 'S-Q-L' if you spotted me the Q & L. BUT! My hope is that eventually this old Marine will be able to return the favor of information from these incredibly gifted posters!I love this site! I learn so much!~~~~~~~~~~~~~Semper fi, Xerxes, USMC |
 |
|
|
|
|
|