Msg 241,Level 16,State 1,Line 3 从字符串转换日期和/或时间时转换失败。
Insert Into
Developer(DevID,UserName,DevPassword,Email,Country,ZipCode,CellPhone,LastLogin)
Values
('Dev123456A', 'Paul Wilson Diu', 'P@ulWilson', 'Paul_Wilson@yahoo.com',
'Philippines', '12345', '0277824893', '10-04-2013'),
我试图在LastLogin中插入日期,我收到此错误。
答案 0 :(得分:0)
在MySQL中,您需要格式化日期:
Insert Into Developer (DevID,UserName,DevPassword,
Email,Country,ZipCode,CellPhone,LastLogin)
Values ('Dev123456A','Paul Wilson Diu','P@ulWilson',
'Paul_Wilson@yahoo.com','Philippines',
'12345','0277824893','2013-10-04');
答案 1 :(得分:0)
使用select
版insert
时,您可以明确说明日期格式:
Into Developer (DevID, UserName, DevPassword, Email, Country, ZipCode, CellPhone, LastLogin)
select 'Dev123456A', 'Paul Wilson Diu', 'P@ulWilson',
'Paul_Wilson@yahoo.com', 'Philippines',
'12345', '0277824893', str_to_date('10-04-2013', '%d-%m-%Y');