| Author |
Topic |
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2006-11-27 : 00:11:43
|
| Dear folks,create table temptable(eno, ename) as select eno, ename from emp.here the problem is it is asking for the datatype for the temporary table.is it not possible to create the temp table without providing the datatypes?thank you very much.Vinod |
|
|
shaggy
Posting Yak Master
248 Posts |
Posted - 2006-11-27 : 00:39:52
|
| for creating table u have to mention datatype. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-11-27 : 00:52:20
|
[code]select eno, ename into temptable from emp[/code] KH |
 |
|
|
sunsanvin
Master Smack Fu Yak Hacker
1274 Posts |
Posted - 2006-11-27 : 00:58:19
|
| Thank you KHVinod |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-27 : 07:18:19
|
| Note that the target table wont have indices, constraints, etc that source table hasMadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-27 : 08:11:53
|
| And if you want to create an empty temp table, just add a nonsense WHERE to it.select eno, ename into temptable from emp where 1 = 0Peter LarssonHelsingborg, Sweden |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-11-27 : 08:19:27
|
"Note that the target table wont have indices, constraints, etc that source table has"But any IDENTITY attribute will be preserved - which can be a nuisance - particularly if you did WHERE 1=0 and then were planning to do a INSERT INTO MyNewTableSELECT *FROM MyOldTableIncludingIdentityColumn Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-11-27 : 09:58:52
|
quote: Originally posted by Peso And if you want to create an empty temp table, just add a nonsense WHERE to it.select eno, ename into temptable from emp where 1 = 0Peter LarssonHelsingborg, Sweden
orselect Top 0 eno, ename into temptable from empMadhivananFailing to plan is Planning to fail |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|