If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Pass a Date to a Timestamp Field Using SQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-06-10, 13:13
SDyke SDyke is offline
Registered User
 
Join Date: Aug 2009
Posts: 14
Pass a Date to a Timestamp Field Using SQL

I am using MS FoxPro to insert data into db2 file the data I am sending is a date which I cast as a datetime value example 07/06/2010 12:00:00 AM.

I get an sql error that token 12 in invalid.

here is my sql syntax

Code:
insertSImain = "Insert Into webprddt7.qasimast(recseq, insptype, docno, partno," +;
			" shipsetid, dwgrev, vendorcode, faiindex, lotqty, sampletype, sampleqty, accptdqty," +;
			" rejdqty, inspdate, inspector, inspsource, rejtindex)" +;
			" Values(" + ALLTRIM(STR(x)) +;
			",1,'" + ALLTRIM(testconnQuery.docno) +;
			"','" + ALLTRIM(testconnQuery.partno) +;
			"','" + ALLTRIM(testconnQuery.jobno) +;
			"','" + ALLTRIM(testconnQuery.revision) +;
			"','" + ALLTRIM(testconnQuery.vendorcode) +;
			"'," + ALLTRIM(STR(testconnQuery.faiindex)) +;
			"," + ALLTRIM(STR(testconnQuery.lotsize)) +;
			"," + ALLTRIM(STR(testconnQuery.sampletype)) +;
			"," + ALLTRIM(STR(testconnQuery.cmss)) +;
			"," + ALLTRIM(STR(testconnQuery.cmaa)) +;
			"," + ALLTRIM(STR(testconnQuery.cmar)) +;
			"," + TTOC(testconnQuery.inspectdt) +;
			",'" + ALLTRIM(testconnQuery.inspectsna) +;
			"',1," + ALLTRIM(STR(y)) + ")"
			
			? insertSImain
			
			If SQLEXEC(testconn, insertSImain) <> -1 Then
				=SQLCOMMIT(testconn)
			ELSE
				If Aerror(odbcerrormsg) > 0 Then
					MessageBox(odbcerrormsg(2))
				EndIf
			EndIF
Reply With Quote
  #2 (permalink)  
Old 07-06-10, 18:40
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
So, what's the output of "? insertSImain"?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On