Database Compatibility Level SQL Server 2008 R2 - sql-server-2008-r2

My SQL Server 2008 R2 database compatibility is currently set to 100.
Is it possible to set the compatibility level to a higher value - say 130 to use some new features?

No. Each version of SQL Server has a range comparability level it supports, and that range is determined by the version.
Here's the list of supported compatibility levels from ALTER DATABASE (Transact-SQL) Compatibility Level:
Product Database Engine Version Compatibility Level Designation Supported Compatibility Level Values
----------------------------------------------------------------------------------------------------------------------------------------
SQL Server 2019 preview 15 150 150, 140, 130, 120, 110, 100
SQL Server 2017 (14.x) 14 140 140, 130, 120, 110, 100
Azure SQL Database logical server 12 130 150, 140, 130, 120, 110, 100
Azure SQL Database Managed Instance 12 130 150, 140, 130, 120, 110, 100
SQL Server 2016 (13.x) 13 130 130, 120, 110, 100
SQL Server 2014 (12.x) 12 120 120, 110, 100
SQL Server 2012 (11.x) 11 110 110, 100, 90
SQL Server 2008 R2 10.5 100 100, 90, 80
SQL Server 2008 10 100 100, 90, 80
SQL Server 2005 (9.x) 9 90 90, 80
SQL Server 2000 8 80 80
As you can see, 2008 R2 supports only 100, 90 and 80 compatibility levels.

Related

Find the number of days in each month between 2 given dates

My input is :
catg_desc equipment_number present_date
STANDBY 123 24-06-2018
OTHERS 123 21-04-2019
READY 123 26-04-2019
JOB 256 26-04-2019
I have solved the scenario in postgresql but is multiplying the number of records. I don't want to increase the number of records in the final table as that can go upto 35,000,000 and difficult to handle in tableau.
using generate_series, we are inserting the data of missing months.
Expected Output:
catg_desc equipment_number present_date Mon-yy no of days
STANDBY 123 24-06-2018 Jun-18 7
STANDBY 124 24-06-2018 Jul-18 31
STANDBY 125 24-06-2018 Aug-18 31
STANDBY 126 24-06-2018 Sep-18 30
STANDBY 127 24-06-2018 Oct-18 31
STANDBY 128 24-06-2018 Nov-18 30
STANDBY 129 24-06-2018 Dec-18 31
STANDBY 130 24-06-2018 Jan-19 31
STANDBY 131 24-06-2018 Feb-19 28
STANDBY 132 24-06-2018 Mar-19 31
STANDBY 133 24-06-2018 Apr-19 20
OTHERS 123 24-06-2018 Apr-19 5
READY 123 26-04-2019 Apr-19 30
READY 124 26-04-2019 May-19 22 (till current date)
JOB 256 26-04-2019 Apr-19 5
JOB 256 26-04-2019 May-19 22 (till current date)
If you have 2 date fields then use datediff(). create a calculated field as below
DATEDIFF('day',[Startdate],[enddate)

Unexpected connection close in HttpClient

I am facing a problem with HttpClient (version 4.5.2) in a web application, I mean, in a multi-threaded way. In normal situation, when a connection request is arrived, a connection is leased from the pool, then used and finally released back to the pool again to be used in future requests again as the following part of log for connection with id 673890 states .
15 Feb 2017 018:25:54:115 p-1-thread-121 DEBUG PoolingHttpClientConnectionManager:249 - Connection request: [route: {}->http://127.0.0.1:8080][total kept alive: 51; route allocated: 4 of 100; total allocated: 92 of 500]
15 Feb 2017 018:25:54:116 p-1-thread-121 DEBUG PoolingHttpClientConnectionManager:282 - Connection leased: [id: 673890][route: {}->http://127.0.0.1:8080][total kept alive: 51; route allocated: 4 of 100; total allocated: 92 of 500]
15 Feb 2017 018:25:54:116 p-1-thread-121 DEBUG DefaultManagedHttpClientConnection:90 - http-outgoing-673890: set socket timeout to 9000
15 Feb 2017 018:25:54:120 p-1-thread-121 DEBUG PoolingHttpClientConnectionManager:314 - Connection [id: 673890][route: {}->http://127.0.0.1:8080] can be kept alive for 10.0 seconds
15 Feb 2017 018:25:54:121 p-1-thread-121 DEBUG PoolingHttpClientConnectionManager:320 - Connection released: [id: 673890][route: {}->http://127.0.0.1:8080][total kept alive: 55; route allocated: 4 of 100; total allocated: 92 of 500]
After using the mentioned connection (id 673890) several times in a normal way which I mentioned above, I notice the following happens in the code:
15 Feb 2017 018:25:54:130 p-1-thread-126 DEBUG PoolingHttpClientConnectionManager:249 - Connection request: [route: {}->http://127.0.0.1:8080][total kept alive: 55; route allocated: 4 of 100; total allocated: 92 of 500]
15 Feb 2017 018:25:54:130 p-1-thread-126 DEBUG PoolingHttpClientConnectionManager:282 - Connection leased: [id: 673890][route: {}->http://127.0.0.1:8080][total kept alive: 54; route allocated: 4 of 100; total allocated: 92 of 500]
15 Feb 2017 018:25:54:131 p-1-thread-126 DEBUG DefaultManagedHttpClientConnection:90 - http-outgoing-673890: set socket timeout to 9000
15 Feb 2017 018:25:54:133 p-1-thread-126 DEBUG DefaultManagedHttpClientConnection:81 - http-outgoing-673890: Close connection
15 Feb 2017 018:25:54:133 p-1-thread-126 DEBUG PoolingHttpClientConnectionManager:320 - Connection released: [id: 673890][route: {}->http://127.0.0.1:8080][total kept alive: 55; route allocated: 3 of 100; total allocated: 91 of 500]
The log says that the connection is requested, leased, used, closed and then released back to the pool. So, my question is that why the connection is closed? And why it is released to the pool after closing?
I know that the connection could be closed by the server, but that is a different situation. In that case, the connection is leased from the pool, determined as stale, so a new connection is established and used but the log I presented above shows a different behavior.
I am aware of two reasons for connection close in HttpClient. First, closed for being idle because their KeepAliveTime is expired. Second, closed by the server which makes the connection stale in the pool. Is there any other reason for connections to be closed?
Based on Oleg Kalnichevski's reply in the HttpClient mailing list, and the examinations which I made, it turned out that the problem was because of 'Connection: close' header sent by the other hand. Another cause that may lead to the same situation is using HTTP/1.0 non-persistent connections.

Timeout when executing MERGE-statement in SQL Server 2016 in simple recovery model

After migrating from SQL Server 2014 to SQL Server 2016, we have been experiencing query timeouts using MERGE-statements on some datasets.
Tested versions:
WORKING: SQL Server 2014 Enterprise (64-bit) (12.0.5532.0)
TIMEOUTS: SQL Server 2016 Enterprise (64-bit) (13.0.4001.0) and SQL Server 2016 Enterprise (64-bit) (13.0.1601.5)
Code to reproduce the timeout error: enter link description here

date and datestring connection

I'm trying to write a code that visits in another website
The other page uses some sort of logic for the dates, for example:
634655520000000000 - 23/2/2012 - Feb 23, 2012
634649472000000000 - 16/2/2012 - Feb 16, 2012
634641696000000000 - 7/2/2012 - Feb 7, 2012
634631328000000000 - 26/1/2012 - Jan 26, 2012
http://www.tase.co.il/TASE/Statistics/ShortSale/ShortSaleData/ShortSalesWeekly.htm?action=1&issubmitted=1&dt=634679712000000000&dateLinksID=3
is the mar 22, 2012
can someone figure out a connection between the dates and this var?
That is the time starting from 1.1.1601 in steps of 100 nano seconds.

SQL Server 2008 R2 Periodically Does Not Accept Connections

I have a problem about connection pooling on Sql Server 2008 R2 environment (OS is Windows Server 2008 R2 X64). I am periodically seeing this in Sql Server error logs:
Event ID: 18056
Description: The client was unable
to reuse a session with SPID 157,
which had been reset for connection
pooling. The failure ID is 29. This
error may have been caused by an
earlier operation failing. Check the
error logs for failed operations
immediately before this error message.
SQL 2008 and SQL 2008 R2 failure id is : RedoLoginException, 29
We have migrated to SQL Server 2008 R2 CU4, running on Windows Server 2008 R2, and the issue continues. SQL Server is having a problem communicating with one of its domain controllers when this happens.
When this happens, SQL Server Agent produces these errors:
[382] Logon to server 'DBINST01\DBINST01' failed (JobManager)
[382] Logon to server 'DBINST01\DBINST01' failed (ConnUpdateJobActivity_NextScheduledRunDate)
[298] SQLServer Error: 258, Unable to complete login process due to delay in prelogin response [SQLSTATE 08001]
[298] SQLServer Error: 258, TCP Provider: Timeout error [258]. [SQLSTATE 08001]
We checked the error logs for previous errors but the only error we can see is this error in the log files. What may cause this error and how can I investigate that?
Please check:
2543687 FIX: Errors when a client application sends an attention signal to SQL Server 2008 or SQL Server 2008 R2
http://support.microsoft.com/kb/2543687/EN-US
The fix for 2008 R2 RTM is in CU 14
2703280 Cumulative Update package 14 for SQL Server 2008 R2