Index
2014-01-03 07:29 – Jeff Johnson : Re: SQL Insert - Solved
2014-01-03 07:44 – Gérard Lochon : Re: SQL Insert - Solved
2014-01-03 07:54 – Jeff Johnson : Re: SQL Insert - Solved
2014-01-03 09:25 – Gérard Lochon : Re: SQL Insert - Solved
Back to top
Re: SQL Insert - Solved

Author: Jeff Johnson

Posted: 2014-01-03 07:29:19   Link

Sorry to bother you guys with this one. I should have known. I

expected that records inserted in sequence would be queried in the same

sequence. I counted the records this morning and they are all there.

Just out of sequence.

I did learn a lot by the discussion, though. Especially Frank's

improved way of building the query strings.

Thanks all.

Jeff

Jeff Johnson

SanDC, Inc.

(623)-582-0323

www.san-dc.com <http://www.san-dc.com>

www.cremationtracker.com <http://www.cremationtracker.com>

www.arelationshipmanager.com <http://www.arelationshipmanager.com>

On 1/3/2014 5:13 AM, Jeff Johnson wrote:

> That makes sense. Thank you Frank. I am also guessing it would be

> faster. What I am seeing could be the result of a timing issue. I am

> going to check this morning to see if the records that are missing are

> reproducible.

>

> Jeff

>

> Jeff Johnson

> SanDC, Inc.

> (623)-582-0323

>

> www.san-dc.com <http://www.san-dc.com>

> www.cremationtracker.com <http://www.cremationtracker.com>

> www.arelationshipmanager.com <http://www.arelationshipmanager.com>

>

>

> On 1/3/2014 4:52 AM, Frank Cazabon wrote:

>> I'm not seeing any problems there. Maybe you could add in a query

>> for the record you just inserted to see if it was inserted.

>>

>> Here's how I would do it, checking if the record inserted

>> successfully, only for testing's sake:

>>

>> * I would change your SQL to use parameters all the way through,

>> * Code like this would be faster/easier to maintain but you can

>> ignore it if you want:

>>

>> TEXT TO m.lcSQL NOSHOW TEXTMERGE

>> INSERT INTO SQLSERVERTABLE (

>> DP_WKSEQNO

>> ,DP_WKCOMPANY_PS

>> ,DP_WKPAYGROUP_PS

>> ,DP_WKPAYGROUP

>> ,DP_WKDATE

>> ,DP_WKTRIPNO

>> ,DP_WKTRIPQ

>> ,DP_WKEVENT

>> ,DP_WKSTDATE

>> ,DP_WKSTTIME

>> ,DP_WKENDDATE

>> ,DP_WKENDTIME

>> ,DP_WKMINS

>> ,DP_WKSTAT

>> ,DP_WKDRIVER

>> ,DP_WKCODE1

>> ,DP_WKCODE2

>> ,DP_WKLOC

>> ,DP_WKACCNT

>> ,DP_WKHUB

>> ,DP_WKTODMILES

>> ,DP_WKMIMARK

>> ,DP_WKWEIGHT

>> ,DP_WKQUANT

>> ,DP_WKHOOK1

>> ,DP_WKPAYCODE

>> ,DP_WKGUID

>> ,DP_WKDATETIME

>> ,DP_WKSTATUS

>> ,DP_WKPROCESSED)

>> VALUES (

>> ?m.wkseqno

>> ,?m.pscompany

>> ,?m.pspaygroup

>> ,?m.wkpaygroup

>> ,?m.wkdate

>> ,?m.wktripno

>> ,?m.wktripq

>> ,?m.wkevent

>> ,?m.wkstdate

>> ,?m.wksttime

>> ,?m.wkenddate

>> ,?m.wkendtime

>> ,?m.wkmins

>> ,?m.wkstat

>> ,?m.wkdriver

>> ,?m.wkcode1

>> ,?m.wkcode2

>> ,?m.wkloc

>> ,?m.wkaccnt

>> ,?m.wkhub

>> ,?m.wktodmiles

>> ,?m.wkmimark

>> ,?m.wkweight

>> ,?m.wkquant

>> ,?m.wkhook1

>> ,?m.wkpaycode

>> ,?m.wkguid

>> ,?m._wkdatetime,

>> ,?m.wkstatus

>> ,'N')

>> ENDTEXT

>>

>>

>> SCAN

>> SCATTER MEMVAR MEMO

>>

>> lnsuccess = SQLEXEC(lnSQLhandle, m.lcSQL)

>>

>> IF lnsuccess < 1

>>

>> =MESSAGEBOX('SQL Select failed: ' + TRANSFORM(lnsuccess) + "'"

>> + m.lcSQL+ "'")

>> lclogstring = lclogstring + lcSQL + lccrlf + lccrlf

>> EXIT

>> ELSE

>> * check if record was saved

>> lnsuccess = SQLEXEC(lnSQLhandle, "SELECT recinserted =

>> COUNT(dp_wkseqno) FROM SQLServerTable WHERE dp_wkseqno = ?m.wkseqno",

>> "c_Result")

>> IF m.lnSuccess < 1

>> * failed

>> ELSE

>> IF c_Result.RecInserted <> 1

>> * failed or multiple seqno

>> SET STEP ON

>> ENDIF

>> ENDIF

>>

>> ENDIF

>>

>> ENDSCAN

>>

>

>

>

> --- StripMime Report -- processed MIME parts ---

> multipart/alternative

> text/plain (text body -- kept)

> multipart/related

> text/html

> image/jpeg

> ---

>

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/52C6BB2F.3080007@san-dc.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2014 Jeff Johnson
Back to top
Re: SQL Insert - Solved

Author: Gérard Lochon

Posted: 2014-01-03 07:44:42   Link

----- Original Message -----

From: "Jeff Johnson" <jeff@san-dc.com>

To: <profoxtech@leafe.com>

Sent: Friday, January 03, 2014 2:29 PM

Subject: Re: SQL Insert - Solved

> Sorry to bother you guys with this one. I should have known. I expected

> that records inserted in sequence would be queried in the same sequence.

> I counted the records this morning and they are all there. Just out of

> sequence.

>

> I did learn a lot by the discussion, though. Especially Frank's improved

> way of building the query strings.

>

> Thanks all.

>

> Jeff

Glad you've find the trick.

Remember that conceptually, in a relational database,

n-uplets (or records) are NOT known by their position ...

that's only a reminder of old -very- procedural way of thinking !

Gérard.

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/B82A7BA3944E44EDB8267D15C35E1E74@MuriellePC

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2014 Gérard Lochon
Back to top
Re: SQL Insert - Solved

Author: Jeff Johnson

Posted: 2014-01-03 07:54:02   Link

On 1/3/2014 6:44 AM, Gérard Lochon wrote:

> ----- Original Message ----- From: "Jeff Johnson" <jeff@san-dc.com>

> To: <profoxtech@leafe.com>

> Sent: Friday, January 03, 2014 2:29 PM

> Subject: Re: SQL Insert - Solved

>

>

>> Sorry to bother you guys with this one. I should have known. I

>> expected that records inserted in sequence would be queried in the

>> same sequence. I counted the records this morning and they are all

>> there. Just out of

>

>> sequence.

>>

>> I did learn a lot by the discussion, though. Especially Frank's

>> improved way of building the query strings.

>>

>> Thanks all.

>>

>> Jeff

>

> Glad you've find the trick.

>

> Remember that conceptually, in a relational database,

> n-uplets (or records) are NOT known by their position ...

> that's only a reminder of old -very- procedural way of thinking !

>

> Gérard.

>

> That makes sense because I am a very old -very- procedural kind of

> guy! ;^)

>

> Jeff

>

> Jeff Johnson

> SanDC, Inc.

> (623)-582-0323

>

> www.san-dc.com <http://www.san-dc.com>

> www.cremationtracker.com <http://www.cremationtracker.com>

> www.arelationshipmanager.com <http://www.arelationshipmanager.com>

>

>

>

> _

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

multipart/related

text/html

image/jpeg

---

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/52C6C0FA.3050003@san-dc.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2014 Jeff Johnson
Back to top
Re: SQL Insert - Solved

Author: Gérard Lochon

Posted: 2014-01-03 09:25:45   Link

----- Original Message -----

> That makes sense because I am a very old -very- procedural kind of guy!

> ;^)

I know how you feel, that i'm not a younger one ;o)

When i started Foxpro, in earlier 2.0 version, it was -for me-

an astonishment ; i used hitherto languages such as assembly

or Cobol for 20 years ; Fox was then a revelation (i knew about

dbase, but never used it) ; it was the very first time i could apply

some of the angriest education evolution during my curses, when,

in mathematics, changes were made to pass from classic one

to modern one (with the sets theory, and vectors, and so on ...)

I couln't then foresee what on earth i could do with that !

And, then, with Fox, God met me :o))

I knew instantly what to do and how to do it !

My debt is to our professors, as far as i can look back on myself.

A second mind revolution came with oop, but that's the next story ...

Tadaam.

Gérard.

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BAC8FF1BCCCE4DB89501DD3DFE4B381B@MuriellePC

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2014 Gérard Lochon