Competition: What’s your favorite Redgate tool? Enter now.

Sript As Insert function adds character T for datetime column

ssurankarssurankar Posts: 1 New member
Every time I use this function (Script as INSERT) on a result set that contains datetime values, then clicking on Script as INSERT option, I noticed that a character 'T' is added in the date column value. It automatically gets placed between date and time. E.g. If I run a select statement to get values from a column of data type - datetime I get the result as  '2019-06-01 00:00:00.000' and after using Script as Insert option on this , then code given in new window is as below

: CREATE TABLE #temptable ( [DATE OF SERVICE] datetime ) INSERT INTO #temptable VALUES ( N'2019-06-01T00:00:00' ) DROP TABLE #temptable

Notice that there is a T added in the values clause. Due to this I get hard time to troubleshoot further issues occurred due to this. Is there any specific reason why character T is added or Is there any setting due to which it adds a T if yes please let me know how I can prevent it from inserting or is this a bug ? Awaiting for your response.

Sushant Surankar



Sign In or Register to comment.