1

这是在 SSMS

我正在尝试插入以下虚拟测试语句及其失败

INSERT INTO Client 
(
     [name], 
     [address], 
     [DOB], 
     [Mobile], 
     [Email], 
     [profession], 
     [refby]
)
VALUES 
(
     'Toby Keith', 
     '8 big dog daddy lane oklahoma 40518', 
     '28/06/2010', 
     '0424 280 185', 
     'tk@hotmail.com', 
     'Country Superstar', 
     'Willie'
)

我得到的信息是:

Msg 241, Level 16, State 1, Line 2
Conversion failed when converting date and/or time from character string.

现在我已经使用了很多次没有问题我错过了什么小愚蠢的东西?

4

1 回答 1

0

使用ISO日期时间格式 -

INSERT INTO Client 
(
     [name], 
     [address], 
     [DOB], 
     [Mobile], 
     [Email], 
     [profession], 
     [refby]
)
VALUES 
(
     'Toby Keith', 
     '8 big dog daddy lane oklahoma 40518', 
     '20100628', 
     '0424 280 185', 
     'tk@hotmail.com', 
     'Country Superstar', 
     'Willie'
)
于 2013-07-24T12:17:06.043 回答