Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Is it possible to use the selece query on a table not yet exists, and define the table and its data in the "tablename" part?If so, what is the correct syntax?
Amethystium
Aged Yak Warrior
701 Posts
Posted - 2005-04-27 : 06:33:06
Yes you can. Something like,
select Column1, Column2, Column3, Column4 into yourNewTablefrom yourTable
You can also add your own columns if the table does not contain the new ones. Something like,
select Column1, Column2, Column3, cast(null as int) as Column4 into yourNewTablefrom yourTable
Good luck!------------->>> BREAKING NEWS!!! <<<------------- Saddam Hussien has weapons of mass destruction
omen
Starting Member
3 Posts
Posted - 2005-04-27 : 08:39:53
Sorry, but I meant something else. I want to select from a table that dosen't exist i.e SELECT * FROM (here is the problem, can i define/create my source table here in some way).I know it's wrong programming but i still need it...
omen
Starting Member
3 Posts
Posted - 2005-04-27 : 08:54:12
Oh, I managed it myself. Thank you anyway.I just used SELECT (data) and changed the program as well.Thanks and sorry for the bother...