@@ -1990,13 +1990,13 @@ public static void PackListParameters(IDbCommand command, string namePrefix, obj
1990
1990
private static bool TryStringSplit ( ref IEnumerable list , int splitAt , string namePrefix , IDbCommand command )
1991
1991
{
1992
1992
if ( list == null || splitAt < 0 ) return false ;
1993
- if ( list is IEnumerable < int > ) return TryStringSplit < int > ( ref list , splitAt , namePrefix , command , "int not null " ,
1993
+ if ( list is IEnumerable < int > ) return TryStringSplit < int > ( ref list , splitAt , namePrefix , command , "int" ,
1994
1994
( sb , i ) => sb . Append ( i . ToString ( CultureInfo . InvariantCulture ) ) ) ;
1995
- if ( list is IEnumerable < long > ) return TryStringSplit < long > ( ref list , splitAt , namePrefix , command , "bigint not null " ,
1995
+ if ( list is IEnumerable < long > ) return TryStringSplit < long > ( ref list , splitAt , namePrefix , command , "bigint" ,
1996
1996
( sb , i ) => sb . Append ( i . ToString ( CultureInfo . InvariantCulture ) ) ) ;
1997
- if ( list is IEnumerable < short > ) return TryStringSplit < short > ( ref list , splitAt , namePrefix , command , "smallint not null " ,
1997
+ if ( list is IEnumerable < short > ) return TryStringSplit < short > ( ref list , splitAt , namePrefix , command , "smallint" ,
1998
1998
( sb , i ) => sb . Append ( i . ToString ( CultureInfo . InvariantCulture ) ) ) ;
1999
- if ( list is IEnumerable < byte > ) return TryStringSplit < byte > ( ref list , splitAt , namePrefix , command , "tinyint not null " ,
1999
+ if ( list is IEnumerable < byte > ) return TryStringSplit < byte > ( ref list , splitAt , namePrefix , command , "tinyint" ,
2000
2000
( sb , i ) => sb . Append ( i . ToString ( CultureInfo . InvariantCulture ) ) ) ;
2001
2001
return false ;
2002
2002
}
@@ -2024,12 +2024,12 @@ private static bool TryStringSplit<T>(ref IEnumerable list, int splitAt, string
2024
2024
else
2025
2025
{
2026
2026
varName = variableName ;
2027
- return "(select val from " + variableName + "_TSS )" ;
2027
+ return "(select cast([value] as " + colType + ") from string_split( " + variableName + ",',') )" ;
2028
2028
}
2029
2029
} , RegexOptions . IgnoreCase | RegexOptions . Multiline | RegexOptions . CultureInvariant ) ;
2030
2030
if ( varName == null ) return false ; // couldn't resolve the var!
2031
2031
2032
- command . CommandText = "declare " + varName + "_TSS table(val " + colType + ");insert " + varName + "_TSS (val) select value from string_split(" + varName + ",',');" + sql ;
2032
+ command . CommandText = sql ;
2033
2033
var concatenatedParam = command . CreateParameter ( ) ;
2034
2034
concatenatedParam . ParameterName = namePrefix ;
2035
2035
concatenatedParam . DbType = DbType . AnsiString ;
0 commit comments