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 |
oceanboy
Starting Member
44 Posts |
Posted - 2007-06-13 : 03:47:50
|
Hello~The task I want to do here is kind of strange but I wonder whether i can do soI have a table with the following columns:ID as int , DESCRIPTION as nvarchar, VALUE as nvarcharThen i will populate the table with the following statement:insert into id, valueselect id, price from table a inner join table b on a.xx = b.xx However, I would like to fill in the DESCRIPTION with the word "Average". Is it possible to do so while I INSERT#12288;INTO that table instead of using UPDATE statement?One thing to bear in mind that this table will not be used only by 1 process but the others. Therefore the VALUE column doesnt not only store price but also other information. That's why the DESCRIPTION column is there.Thus, the table will look like this1 Average 52 Average 43 Average 51 Discount 53 Discount 1Thanks in advance! |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-06-13 : 03:55:31
|
Yes.INSERT INTO NewTable (ColA, ColB, ColC) SELECT Col1, 'Average', ColGreen FROM OldTablePeter LarssonHelsingborg, Sweden |
|
|
oceanboy
Starting Member
44 Posts |
Posted - 2007-06-13 : 04:11:16
|
coolio! I thought it could work and you have proved me right! Thanks a zillion! |
|
|
|
|
|