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 |
|
danielfrost
Starting Member
4 Posts |
Posted - 2004-02-16 : 09:07:44
|
| Hi!I've just copied some data for one SQL Server to another, and now I need to transfer som data from one table to another. It should be simple - but i'm confused!I want to transfer a column named "email" and then I need to add another parameter as well.I've tried this:INSERT INTO Subscribers (email, fk_usertype) SELECT email FROM Results, "2"But I get this:The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.The result table is where I want to copy the data from, and the sunscriber table is where it shuld be saved!The fk_usertype column is in the Subscriber table, but needs to filled!How do I do this???/Daniel - daniel@activedeveloper.dk |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2004-02-16 : 09:18:32
|
| Close enough...INSERT INTO Subscribers (email, fk_usertype)SELECT email, 2 FROM ResultsIf fk_usertype is of varchar datatype, you can enclose the 2 in single quotes (double quotes won't work). If it is of numeric or int (or smallint/tinyint) datatype, you don't need the quotes.OS |
 |
|
|
|
|
|