我想使用SMO生成一组插入语句来在环境之间复制数据。我有这个工作,但由于某种原因,datetime字段被格式化为十六进制值,这些值被转换为datetime。这使得脚本难以阅读且无法更新。有没有办法让我改变它以使用日期的字符串表示?
用于生成的代码:
scripter = New Scripter(<server>)
scripter.Options.ScriptData = True
...
For Each s As String In scripter.EnumScript(list)
writer.WriteLine(FormatScript(s))
Next
我想改变这个......
INSERT [dbo].[dmMessages] ([MessageId], [MessageCd], [MessageDesc], [Status], [EnteredBy], [EnteredDt])
VALUES (1, N'GenericMessages.FieldRequired', N'The {0} field is required.', 1, N'System', CAST(0x00009B4900000000 AS DateTime))
到
INSERT [dbo].[dmMessages] ([MessageId], [MessageCd], [MessageDesc], [Status], [EnteredBy], [EnteredDt])
VALUES (1, N'GenericMessages.FieldRequired', N'The {0} field is required.', 1, N'System', '2009-1-1 13:00:00:000')