Click here to Skip to main content
15,899,679 members
Home / Discussions / Database
   

Database

 
AnswerRe: Get all Sundays between 2 dates in sql Pin
vivek-g16-Apr-07 20:28
vivek-g16-Apr-07 20:28 
GeneralRe: Get all Sundays between 2 dates in sql Pin
cst_cfit17-Apr-07 23:32
cst_cfit17-Apr-07 23:32 
AnswerRe: Get all Sundays between 2 dates in sql Pin
gauthee16-Apr-07 20:28
gauthee16-Apr-07 20:28 
AnswerRe: Get all Sundays between 2 dates in sql Pin
DQNOK17-Apr-07 4:16
professionalDQNOK17-Apr-07 4:16 
GeneralRe: Get all Sundays between 2 dates in sql Pin
cst_cfit17-Apr-07 23:32
cst_cfit17-Apr-07 23:32 
AnswerRe: Get all Sundays between 2 dates in sql [modified] Pin
DQNOK17-Apr-07 7:58
professionalDQNOK17-Apr-07 7:58 
GeneralRe: Get all Sundays between 2 dates in sql Pin
cst_cfit17-Apr-07 23:30
cst_cfit17-Apr-07 23:30 
Questionretrieving the highest IDENTITY number in a table:sqlserv05? Pin
giddy_guitarist16-Apr-07 10:21
giddy_guitarist16-Apr-07 10:21 
AnswerRe: retrieving the highest IDENTITY number in a table:sqlserv05? Pin
Mark J. Miller16-Apr-07 12:20
Mark J. Miller16-Apr-07 12:20 
GeneralRe: retrieving the highest IDENTITY number in a table:sqlserv05? Pin
giddy_guitarist17-Apr-07 9:48
giddy_guitarist17-Apr-07 9:48 
GeneralRe: retrieving the highest IDENTITY number in a table:sqlserv05? [modified] Pin
giddy_guitarist18-Apr-07 4:09
giddy_guitarist18-Apr-07 4:09 
QuestionVB.NET accessing SQL Server 2005 Pin
Marcus J. Smith16-Apr-07 9:43
professionalMarcus J. Smith16-Apr-07 9:43 
AnswerRe: VB.NET accessing SQL Server 2005 Pin
Colin Angus Mackay16-Apr-07 11:24
Colin Angus Mackay16-Apr-07 11:24 
QuestionProblem creating jobs in SQLServer 2005 Pin
allende16-Apr-07 8:19
allende16-Apr-07 8:19 
QuestionCase insensitive order by Pin
ATCsharp16-Apr-07 6:29
ATCsharp16-Apr-07 6:29 
AnswerRe: Case insensitive order by Pin
andyharman16-Apr-07 7:11
professionalandyharman16-Apr-07 7:11 
QuestionCLOB Convert to String Pin
ytubis16-Apr-07 4:57
ytubis16-Apr-07 4:57 
AnswerRe: CLOB Convert to String Pin
Krish - KP16-Apr-07 21:36
Krish - KP16-Apr-07 21:36 
QuestionHow do I protect Access database (MDB file)? Pin
testmail_12316-Apr-07 2:44
testmail_12316-Apr-07 2:44 
AnswerRe: How do I protect Access database (MDB file)? Pin
Dave Kreskowiak16-Apr-07 4:18
mveDave Kreskowiak16-Apr-07 4:18 
GeneralRe: How do I protect Access database (MDB file)? Pin
testmail_12317-Apr-07 1:06
testmail_12317-Apr-07 1:06 
AnswerRe: How do I protect Access database (MDB file)? Pin
Mark J. Miller16-Apr-07 12:26
Mark J. Miller16-Apr-07 12:26 
QuestionHelp with cursor Pin
allende16-Apr-07 1:54
allende16-Apr-07 1:54 
AnswerRe: Help with cursor Pin
Pete O'Hanlon16-Apr-07 2:02
mvePete O'Hanlon16-Apr-07 2:02 
GeneralRe: Help with cursor Pin
allende16-Apr-07 2:53
allende16-Apr-07 2:53 
Thanks Pete,

I will be more specific, I tried your suggestion but still doesn't work...I'm not an SQL expert Blush | :O )
I will rite here the involved tables and their main fields:

Orders(OrderId)
OrderDetail(OrderId, ProductSubCode, Quantity)
Products(ProductSubCode, Quantity)

When an order is canceled I want to get all the items on it and re-insert them in the Product table (summarizing with the amount already in that table)

If I do a select of all the items in a given order as you told me I will get something like this:

"SELECT * INTO #TMP FROM ORDERDETAIL WHERE ORDERID=30"

OrderId ProductSubCode Quantity
30 BD0002 10
30 BD0004 4

Now I need to re-insert those quantities into the Products table.

I can't figure out how I ca do that without a cursor since I need to iterate through the records in the temporary table.

Of course I can still be missing alternatives

Thanks a lot.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.