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 |
taunt
Posting Yak Master
128 Posts |
Posted - 2013-06-11 : 13:33:36
|
Hello I'm having issues inserting data in an existing table. I do this:SELECT *into itemsNRSHFROM itemsWHERE (ReleaseDate = '06/11/2013') AND (StockQty > 0)That will create a table with the data I want, but if the table is already there it won't. What do I need to try? When I tried:into into itemsNRSHSELECT *FROM itemsWHERE (ReleaseDate = '06/11/2013') AND (StockQty > 0)It says no column list was used. So what am I doing wrong? |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-06-11 : 13:38:45
|
quote: Originally posted by taunt Hello I'm having issues inserting data in an existing table. I do this:SELECT *into itemsNRSHFROM itemsWHERE (ReleaseDate = '06/11/2013') AND (StockQty > 0)That will create a table with the data I want, but if the table is already there it won't. What do I need to try? When I tried:into into itemsNRSHSELECT *FROM itemsWHERE (ReleaseDate = '06/11/2013') AND (StockQty > 0)It says no column list was used. So what am I doing wrong?
Are you sure this was the error? Can you copy/paste the exact error thrown by the SQL server?CheersMIK |
|
|
djj55
Constraint Violating Yak Guru
352 Posts |
Posted - 2013-06-11 : 15:04:37
|
You are correct the select * into will create the table and I assume you ment INSERT INTO itemsNRSH select *?Are you executing the second query after the first?djj |
|
|
taunt
Posting Yak Master
128 Posts |
Posted - 2013-06-11 : 17:17:23
|
Yep it was annoyed that I didn't have the columns mapped. I re did it with the columns in itemsNRSH and items, and it worked. |
|
|
|
|
|