On 10/11/2013 11:42 AM, Frank Cazabon wrote:
On 11/10/2013 02:39 PM, Stephen Russell wrote:
On Fri, Oct 11, 2013 at 1:28 PM, Jeff Johnson <[email protected]> wrote:

I have done some SQL Server queries using date ranges but I want to insert
datetimes into a SQL Server table.

I used SELECT * FROM DB.TABLE WHERE adatefield = "2013-10-20" so I am
guessing to insert a date into SQL Server I use:

INSERT INTO DB.TABLE (adatefield) VALUES ("2013-10-20")

How would I go about inserting a datetime() field into a SQL Server
datetime field?
-----


INSERT INTO DB.TABLE (adatefield) VALUES ("2013-10-20 14:14:58")  *
hr:min:sec



I would actually recommend using parameters if possible:

m.MyDateTime = DATETIME()

INSERT INTO DB.TABLE (adatefield) VALUES (?m.MyDateTime)




Frank.

Frank Cazabon



Frank: I am building a string for SQL Pass through and am getting an error. How would I put that in a string:

lcSQL = 'INSERT INTO DB.TABLE (astringfield, adatefield) VALUES ("' + m.string + '", ?m.MyDateTime)'


Jeff

---------------

Jeff Johnson
[email protected]
(623) 582-0323

www.san-dc.com
www.arelationshipmanager.com



_______________________________________________
Post Messages to: [email protected]
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/[email protected]
** 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.

Reply via email to