Click here to Skip to main content
15,915,319 members
Home / Discussions / Database
   

Database

 
GeneralParamaterized Queries Pin
David Salter20-May-03 11:22
David Salter20-May-03 11:22 
GeneralADO help pls Pin
BlackRider20-May-03 5:16
BlackRider20-May-03 5:16 
GeneralAttn: sql gurus, help! Pin
Member 9619-May-03 12:38
Member 9619-May-03 12:38 
GeneralRe: Attn: sql gurus, help! Pin
andyharman19-May-03 13:58
professionalandyharman19-May-03 13:58 
GeneralRe: Attn: sql gurus, help! Pin
Member 9619-May-03 16:41
Member 9619-May-03 16:41 
GeneralRe: Attn: sql gurus, help! Pin
Member 9620-May-03 5:15
Member 9620-May-03 5:15 
GeneralRe: Attn: sql gurus, help! Pin
Anonymous25-May-03 14:26
Anonymous25-May-03 14:26 
GeneralMostly working stored procedure revised Pin
Mike Osbahr19-May-03 11:09
Mike Osbahr19-May-03 11:09 
For each XVal, YVal in tblCurrent there exists at least one record in tblPrevious. Each XVal, YVal in tblPrevious has at least one record where EndTime will equal @currstart. All Col18 and Col19 values in tblPrevious are non-NULL decimals. All Col18 and Col19 values in tblCurrent are NULL.

Given these conditions can anyone explain why after running the following stored procedure Col18 will contain values for each XVal, YVal; but Col19 will sometimes contain NULL for a YVal greater than some apparently random number?

PROCEDURE CopyIDs
DECLARE @myXVal INTEGER,
DECLARE @currstart DATETIME
AS
DECLARE @myCntr INTEGER

SET @myCntr = 1

WHILE (@myCntr <= 250)
BEGIN
UPDATE tblCurrent
SET Col18 = prev.Col18, Col19 = prev.IDCol19
FROM tblPrevious prev INNER JOIN tblCurrent curr
ON prev.XVal = curr.XVal AND prev.YVal = curr.YVal
AND prev.EndTime = @currstart
WHERE curr.XVal = @myXVal AND curr.YVal = @myCntr

SET @myCntr = @myCntr + 1
END

About 80% of the time, the values will be copied for both fields. For The other 20%, after the first 60 to 200 records have been updated correctly the remainder of the records will contain NULL in the field Col19.

This procedure is typically called multiple times with different XVals. When there is a failure, 95% of the time only the first call will fail to copy Col19 correctly.

>>>-----> MikeO
GeneralClarification Pin
Mike Osbahr19-May-03 16:18
Mike Osbahr19-May-03 16:18 
GeneralDesign Question Pin
Mark Sanders18-May-03 9:33
Mark Sanders18-May-03 9:33 
GeneralRe: Design Question Pin
Jeremy Oldham19-May-03 3:42
Jeremy Oldham19-May-03 3:42 
Generalcollation , locale ID Pin
Hesham Amin16-May-03 5:36
Hesham Amin16-May-03 5:36 
GeneralGot it !! Pin
Hesham Amin16-May-03 21:23
Hesham Amin16-May-03 21:23 
GeneralInstalling MSDE question Pin
DxSolo16-May-03 5:02
DxSolo16-May-03 5:02 
GeneralRe: Installing MSDE question Pin
Wayne Phipps16-May-03 21:58
Wayne Phipps16-May-03 21:58 
QuestionDatabase create code problem with deskop sql 2000? Pin
Bart-Man15-May-03 10:31
Bart-Man15-May-03 10:31 
AnswerSOLUTION Pin
Bart-Man16-May-03 5:29
Bart-Man16-May-03 5:29 
GeneralFetching Text ado.net(OLEDB) from sysbase DB Pin
vnagaraj14-May-03 8:26
vnagaraj14-May-03 8:26 
QuestionSSN Format Query? Pin
Steven Behnke14-May-03 7:03
Steven Behnke14-May-03 7:03 
Questionindependent Recordset ? Pin
AndreasSaurwein14-May-03 5:19
sussAndreasSaurwein14-May-03 5:19 
AnswerRe: independent Recordset ? Pin
Andreas Saurwein15-May-03 1:42
Andreas Saurwein15-May-03 1:42 
GeneralDate functions Pin
Anonymous13-May-03 10:59
Anonymous13-May-03 10:59 
GeneralRe: Date functions Pin
Anonymous13-May-03 21:04
Anonymous13-May-03 21:04 
GeneralBacking up and restoring tables in SQL Server Pin
prinju philip12-May-03 20:58
sussprinju philip12-May-03 20:58 
GeneralRe: Backing up and restoring tables in SQL Server Pin
Arjan Einbu20-May-03 20:19
Arjan Einbu20-May-03 20:19 

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.