0

When using Tasks - Generate Scripts... it is now generating the DateTime2 with a Prefix of "T" for the time (example 1) instead of leaving it blank (example 2). How do I remove the Prefix "T" when generating my scripts?

Example 1: CAST(N'2017-04-18T00:00:00.0000000' AS DateTime2)

Example 2: CAST(N'2017-04-18 00:00:00.0000000' AS DateTime2)

I have tried generating at a previous version of SQL i.e. 2008 or 2012 to see if it was a versioning issues which still did not work.

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
  • 1
    Why is this a problem? Are you saying the cast doesn't work, or generating it in the format you want doesn't? – ProgrammingLlama Dec 12 '22 at 03:52
  • 2
    FYI, the "T" version is the ISO 8601 standard datetime format. – Dan Guzman Dec 12 '22 at 04:45
  • 1
    As Dan commented per [documentation](https://learn.microsoft.com/en-us/sql/t-sql/data-types/datetime2-transact-sql?view=sql-server-ver16#supported-string-literal-formats-for-datetime2) – Squirrel Dec 12 '22 at 04:52
  • I'm wanting to generate it in the Example 2 because when I merge my changes it now thinks I've changed all my tables, where I haven't. I know it is a standard format, but is there a way to revert it back or toggle it on and off? – Display name Dec 12 '22 at 18:49

0 Answers0