Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Insert

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2012-10-22 : 15:46:51
Is it possible to convert a field to date time during an insert?
I'm getting Incorrect syntax near keyword convert


insert into bmprdaudes_sql(
item_no,
seq_no,
convert(datetime,aud_dt),
convert(datetime,aud_tm),
aud_action,
aud_user_name,
aud_terminal_no,
comp_item_no,
alt_item_number,
qty_per_par,
attaching_oper_no,
scrap_factor,
activity_fg,
aud_user_name_defined_field,
convert(datetime,effectivity_dt),
convert(datetime,obsolete_dt),
mfg_uom,
filler_0005,
loc,
backflush_fg,
bulk_issue_fg,
scrap_qty)
from bmprdaud_sql


russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2012-10-22 : 15:49:43
Yes, but seems like you want to insert from a select statement, and you're missing the select.

INSERT INTO yourTable (field_list)
SELECT someColumns
FROM anotherTable;
Go to Top of Page
   

- Advertisement -