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 |
TRACEYSQL
Aged Yak Warrior
594 Posts |
Posted - 2007-04-28 : 05:33:31
|
i am trying to display the results but not have the order id display on 2nd lineUSE NORTHWINDDECLARE @OrderId intDECLARE @Orders TABLE ( OrderId int, ProductId int, ItemTotal money)DECLARE CaracasOrders CURSOR FAST_FORWARD READ_ONLYFOR SELECT OrderID FROM Orders WITH (NOLOCK) WHERE ShipCity = 'Caracas'OPEN CaracasOrdersFETCH NEXT FROM CaracasOrders INTO @OrderIdWHILE (@@FETCH_STATUS = 0)BEGIN INSERT INTO @Orders SELECT @OrderId, ProductId, (Quantity * UnitPrice) As ItemTotal FROM [Order Details] WHERE OrderID = @OrderID FETCH NEXT FROM CaracasOrders INTO @OrderId ENDCLOSE CaracasOrdersDEALLOCATE CaracasOrdersSELECT * FROM @Orders 10268 29 990.000010268 72 111.200010785 10 310.000010785 75 77.5000so i get this10268 29 990.0000 72 111.200010785 10 310.0000 75 77.5000 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-04-28 : 05:37:19
|
Why don't you do this in your front end ? It is much easier. KH |
 |
|
TRACEYSQL
Aged Yak Warrior
594 Posts |
Posted - 2007-04-28 : 06:14:19
|
The front end is not ready so i was going to be emailing the results to a user.I did the same thing using northwind as an example. |
 |
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
|
|
|