I am using SQL Server 2012 Express. The database has a [config] table with a member of type 'datetime'. Exporting it (only data) using Management Studio as an SQL script generates:
INSERT [dbo]. [config] ([id], [name], [creation_date], ...) VALUES (13, N'Test ', CAST (N'2014-11-17 09:29: 07.047' AS DateTime), .. .)
Now, when executing the generated script, he complains that a datetime value is not valid. I can manually fix this by replacing the space between date and time with “T”:
INSERT [dbo]. [config] ([id], [name], [creation_date], ...) VALUES (13, N'Test ', CAST (N'2014-11-17 T 09: 29: 07.047' AS DateTime) ,. ..)
Looking into the docmentation datetime, a space format seems not to be supported.
How can I generate scripts with the supported datetime format (ie including "T")?
How to import a format that uses space without changing the imported script?
By the way, it looks like it works on other installations of SQL Server, but I cannot find the difference. Also uninstalling and reinstalling SQL Server did not help.
datetime sql-server iso8601
user2261015
source share