[DB-SIG] Insert Problem solved, one question please reply
Marcos Sánchez Provencio
marcos at burke.ath.cx
Thu Oct 21 11:12:20 CEST 2004
I suppose mx.ODBC will deal very well with mx.DateTime parameters...
Khawaja Shahzad Sadiq escribió:
>Hi ,
> I configured out the problem with sql insert
>with mxODBC.
>I use this statement.
>areaI = "INSERT INTO rss_feed_items
>(item_title,item_author,item_permalink,item_description) VALUES
>(?,?,?,?)"
> c2 = db.cursor()
> c2.execute(areaI, (feed_item_title , item_author, feed_item_link,
>feed_item_feeddescription_utf8))
> db.commit()
>
>The problem was date and time variable for which i used ? SQL gave error of:
>item_dmodified
>if use it in above query. I get this error:
>
>DataError: ('22005', 0, '[Microsoft][ODBC SQL Server Driver]Invalid
>character value for cast specification', 4579)
>
>Since i am getting the date and time in raw format from rss file and
>converting it into string like this:
>
>s=item_dmodified
>zs=email.Utils.mktime_tz(email.Utils.parsedate_tz(s))
>item_dmodified = time.strftime('%m-%d-%Y %H:%M', time.localtime(zs));
>Tue, 19 Oct 2004 19:27:33 GMT -> 10/19/2004 6:00:00 AM
>
>the targe filed item_date in MS SQL server is small date and time.
>
>If i do separate query string for item_date it works but it goes into
>next row not with and i want to insert it 1 single query. I have both
>mxODBC base and commercial.
>
>Please tell me what should i do? Thanks for your help and suggestion.
>I hope you would help.
>
>
>
More information about the DB-SIG
mailing list