Requirement SQL Server version
Closed this issue · 1 comments
So first of all, I'm using your framework for the TempTable Feature in my development environment with SQL-Server 2019.
There everything works like a charm.
Now I've an issue with a SQL-Server Version 2014, when I use the Extension "BulkInsertValuesIntoTempTableAsync".
I get the following exception:
Microsoft.Data.SqlClient.SqlException (0x80131904): Falsche Syntax in der Nähe des IF-Schlüsselworts. bei Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) in H:\tsaagent1\_work\21\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlConnection.cs:Zeile 2205. bei Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) in H:\tsaagent1\_work\21\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\TdsParser.cs:Zeile 1668. bei Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) in H:\tsaagent1\_work\21\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\TdsParser.cs:Zeile 0. bei Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) in H:\tsaagent1\_work\21\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlCommand.cs:Zeile 3730. bei Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) in H:\tsaagent1\_work\21\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlCommand.cs:Zeile 1966. bei Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery() in H:\tsaagent1\_work\21\s\src\Microsoft.Data.SqlClient\netfx\src\Microsoft\Data\SqlClient\SqlCommand.cs:Zeile 1419. bei Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject) bei Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.ExecuteSqlRaw(DatabaseFacade databaseFacade, String sql, IEnumerable`1 parameters) bei Thinktecture.EntityFrameworkCore.TempTables.SqlServerTempTableReference.Dispose() bei Thinktecture.EntityFrameworkCore.TempTables.TempTableQuery`1.Dispose()
I also already have a guess:
When I open SqlServerTempTableReference, and go to line 65, I see the SQL-Statement DROP TABLE IF EXISTS...
.
But this is first introduced in SQL-Server 2016, so it won't work in SQL-Server 2014.
Do you know, which SQL-Server Version is required for using your Framework?
Hi, your "guess" is correct. The error comes due to IF EXISTS
clause which was introduced in SQL Server 2016.
https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-table-transact-sql?view=sql-server-2016
IF EXISTS
Applies to: SQL Server ( SQL Server 2016 (13.x) through current version).