Using moment() function with bulk insert

Hi All,

I'm trying to create an SQL bulk insert query that uses moment() to set the value for a datetime field (two in fact). I get a JSON error when I try to preview the query ("Unexpected token F in JSON at position 0" and it throws an ISE when it runs for real.

Is this a bug or does moment() not work with bulk inserts? Is there a work around to using moment()?

Thanks
Josh

Hi @joshpayne! Thanks for posting and welcome! :sunglasses:

I think the return type from moment() is an object, so the error is likely from trying to parse this as an object. Can you successfully run the query with moment().toString() instead?

1 Like

Thanks! That fixed this particular problem. Getting new errors on bulk inserts but I’ll keep plugging away.