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 |
stahorse
Yak Posting Veteran
86 Posts |
Posted - 2014-02-07 : 08:24:51
|
HiIs there a way I can:INSERT INTO TableASELECT * FROM TableBbut exclude one column from TableB?My TableB has ID which is IDENTITY(1,1), I want to select everything to TableA except the ID. Without listing the columns |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2014-02-07 : 11:38:05
|
quote: Originally posted by stahorse Without listing the columns
No. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-02-10 : 08:52:49
|
quote: Originally posted by stahorse HiIs there a way I can:INSERT INTO TableASELECT * FROM TableBbut exclude one column from TableB?My TableB has ID which is IDENTITY(1,1), I want to select everything to TableA except the ID. Without listing the columns
You cant do itbut you can generate the required column list easily using catalog view INFORMATION_SCHEMA.COLUMNS. just filter for TABLE_NAME = 'Your Table Name' to get all columns. copy and paste the result into your actual query to get column list. Add a filter as..WHERE COLUMN_NAME <> 'ID Column name' to exclude the id column from the list------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|
|
|