1
Vote

datetime2

description

When I use
 
<#foreach(var column in table.Columns) {#>
 <#= column.GetName() #> <#= column.GetSqlType() #> NULL
<#}#>
 
against a table that has datetime2 columns the result type is datetime2(7,0). It should be datetime2(7).
 
I see where it can be fixed near line 38 of ColumnExtensions.cs. Do you agree this is a problem? Or should I be doing something else.

comments

trendoid wrote May 30, 2012 at 4:09 PM

Here is what I used for a work around.


<#foreach(var column in table.Columns) {#>
,<#= column.GetName() #> <#= (column.GetSqlType() == "datetime2(7,0)") ? "datetime2(7)" : column.GetSqlType() #> NULL
<#}#>

sandermvanvliet wrote Nov 9, 2012 at 5:21 PM

I think the current extension method is not yet smart enough. Must admit that I've not tested it with all available datatypes.
The fix should be easy enough, if scale is zero just omit it. I'll see if I can get around to fixing it.

wrote Feb 13, 2013 at 4:44 AM