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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-07-10 : 09:11:27
|
| Julie writes "I have a database named Grow, with a table named Variety. I concatenated 3 columns from this table to make one column. I also tied in the VarietyID. How do I get the results from this query saved in a new table named Herbs Use Grow Create Table Herbs (VarietyID int, CommonNameFirst nvarchar(50) not Null, LatinNameFirst nvarchar (50) not Null) Insert into Herbs values (ID, CommonName, LatinName) select VarietyID as 'ID' VarietyName + ', ' + Family + ' ' + Genus as 'CommonName', Family + ' ' + Genus + ', ' + VarietyName as 'LatinName' from Variety where Category = 'Herbs' I need the data that is returned from the query saved in the new table Herbs. " |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-07-10 : 09:14:31
|
| Try thisInsert into Herbs values (ID, CommonName, LatinName) select VarietyID ,VarietyName + ', ' + Family + ' ' + Genus , Family + ' ' + Genus + ', ' + VarietyName from Variety where Category = 'Herbs' MadhivananFailing to plan is Planning to fail |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-10 : 09:14:51
|
| Just drop the valuesInsert into Herbs (ID, CommonName, LatinName) select VarietyID as 'ID' VarietyName + ', ' + Family + ' ' + Genus as 'CommonName', Family + ' ' + Genus + ', ' + VarietyName as 'LatinName' from Variety where Category = 'Herbs'==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|
|
|