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 |
|
CM670
Starting Member
2 Posts |
Posted - 2012-10-19 : 05:39:18
|
| I have a table which holds the status of peoples orders. It holds information on order_id, order_status, order_desc, letter. A letter is printed for each of the different statuses. However for one status i need two different letters to be printed. So far i have doneinsert into order_status (order_id,order_status, order_desc, letter) values('025', 'Dispatched', 'Black tailored coat ','DPT notification');This prints the DPT notification fine but i need another letter to print along with this. How can I insert two values into the same field?It would be helpful if anyone has any ideas on how to do this!Thanks. |
|
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2012-10-19 : 05:53:34
|
| you could try an if statement, for example see below, not near a machine but something alone these lines, Or an insert trigger to insert the additional lines based on what's being insertedDECLARE @Orderstatus INTSET @Orderstatus = 2if @Orderstatus = 1BEGIN INSERT INTO order_status (order_id,order_status, order_desc, letter) VALUES('025', 'Dispatched', 'Black tailored coat ','DPT notification');ENDELSE IF @Orderstatus = 2BEGIN ---first row INSERT INTO order_status (order_id,order_status, order_desc, letter) VALUES('025', 'Dispatched', 'Black tailored coat ','DPT notification'); ---second row INSERT INTO order_status (order_id,order_status, order_desc, letter) VALUES('065', 'get', 'sdf ','fdfd');END |
 |
|
|
|
|
|
|
|