更新时间:2023-02-06 12:09:20
您需要使用正确的参数.这是 msdn 图表 http://msdn.microsoft.com/en-us/library/ms187928.aspx
You need to use the correct parameter. Here's the msdn chart http://msdn.microsoft.com/en-us/library/ms187928.aspx
就您而言,我认为您需要附加01"并使用它
In your case, i believe you need to append the '01' and use this
declare @val VARCHAR(8)
SET @val = '201212'
set @val = @val + '01'
print CONVERT(DATETIME, @val, 12)
12 是 ISO 格式,将采用 yymmdd 或 yyyymmdd
12 is the ISO format and will take either yymmdd or yyyymmdd