Verify if SNAPSHOT isolation level is on in SQL Server 2008 R2 - sql-server-2008-r2

What SQL will I execute in SSMS for SQL Server 2008 R2 to know if SNAPSHOT isolation level is turned on in the database?

SELECT snapshot_isolation_state_desc from sys.databases
where name='<your database name here>'
will allow you to check if it is turned on or not.

Related

How to restore backup from SQL Server 2008 R2 in SQL Server 2014?

I took a backup of a database in SQL Server 2008 R2 via SSMS backup utility and restored the same backup in SQL Server 2014 via SSMS backup utility and the database restore. It was successful but am not seeing any tables in SQL Server 2014 after restoring the database. Can someone help me to restore the SQL Server 2008 R2 database backup (.bak) in 2014?
The sql 2008 r2 database backup file should be completely compatible on sql 2014. you can try to restore the database on sql 2008 r2 at first, and check if the table was deleted before the backing up.

Export Active Directory data from SQL Server 2008 R2

Is there any way to extract Active Directory data from SQL Server 2008 R2 in order to restore it on another SQL Server 2008?
Thanks in advance
If you mean you need to transfer logins then I always use sp_help_revlogin.

Can't restore compatible database back to SQL Server 2008 R2

We have client with SQL Server 2008 R2 and database created on same server. So the compatibility is set as 10.
We're running mostly on SQL 2012. In event we backup database from 2008 and restore in 2012, make some data changes (no schema change), and then back it up again, we can't restore back to 2008.
It would prompt "No backupset selected to be restored". But seems that the compatibility is retained. Opening Management Studio as Administrator doesn't work either.
This method use to work fine with one previous client, but they have upgraded to 2012 now.
You are having a compatibility issue.
Just set compatibility mode and try to restore database again.
ALTER DATABASE Databasename SET COMPATIBILITY_LEVEL = 80
You have to set COMPATIBILITY_LEVEL as per your database is
suppose if backup database COMPATIBILITY_LEVEL is 90 than set COMPATIBILITY_LEVEL = 90.
Now restore database and if database restored successfully than again set previous COMPATIBILITY_LEVEL to the level it was before restore.

SQL Linked Server Update Openquery syntax error

I am trying to update data in a PervasiveSQL backend (Sage ERP system) from SQL Server 2008 R2 via a Linked Server setup. Below are details and error msg returned... The kicker is that the update statement works on a development box just fine, very similar setup. Any help will be GREATLY appreciated!
Environment:
Windows Server 2008 Enterprise (Cloud server, Rackspace)
Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (Intel X86) Express Edition with Advanced Services on Windows NT 6.1 (Build 7601: Service Pack 1) (WOW64) (Hypervisor)
Sage Timberline ERP running with Pervasive SQL v.10 backend
Setup:
We have a LINKED SERVER setup in SQL Server 2008, using a 32-bit Timberline Driver (OBDC)
Linked server is using a MSDASQL provider with the following two properties set to TRUE, “Allow inprocess” and “Non Transacted Updates”
Issue:
We can successfully pull data, see query below, from linked server. We can successfully browse objects via the linked server in SSMS.
SELECT *
FROM OPENQUERY (TLLINKSERVER, 'SELECT * FROM TABLE1 where JOBID = ''00-00-111111''')
However the UPDATE statement below returns the following error.
UPDATE OPENQUERY(TLLINKSERVER, 'SELECT * FROM TABLE1 WHERE JOBID = ''00-00-111111''')
SET DATEFIELD = '2013-07-15'
Error:
OLE DB provider "MSDASQL" for linked server "TLLINKSERVER" returned
message "[Sage Timberline Office][Sage Timberline Office ODBC
Driver]Syntax Error.". OLE DB provider "MSDASQL" for linked server
"TLLINKSERVER" returned message "[Sage Timberline Office][Sage
Timberline Office ODBC Driver]UPDATE "\SERVER1\Company
Data\DATA\COMPANY1\"<< ??? >>."TABLE1" SET "DATEFIELD1"=? WHERE
"JOBID"=? AND "DATEFIELD1"=?".
Msg 7343, Level 16, State 4, Line 1
The OLE DB provider "MSDASQL" for linked server "TLLINKSERVER" could not
UPDATE table "[MSDASQL]".
Why not make things easier? Does PervasiveSQL not support direct updates via a linked server?
UPDATE TLLINKSERVER...TABLE1
SET DATEFIELD = '2013-07-15'
WHERE JOBID = '00-00-111111';
Or maybe:
SELECT * FROM OPENQUERY(TLLINKSERVER, 'UPDATE TABLE1
SET DATEFIELD = ''2013-07-15''
WHERE JOBID = ''00-00-111111'');
While the UPDATE OPENQUERY syntax you're using is supported for SQL Server linked servers, I'm not sure that's true for other platforms such as PervasiveSQL...
This is how I update table sin Oracle from SSMS.
The Linked server name in this case is MyLinkedServer.
I am updating the column CONTACT_EMAIL to MyEmail#MyDomain.COM where the STATE is one of the following (KY,OH,NY,PA,VA,DC):
UPDATE L
SET L.CONTACT_EMAIL ='MyEmail#MyDomain.COM'
FROM OPENQUERY(MyLinkedServer, 'SELECT * from MyTable')L
WHERE L.STATE IN('KY','OH', 'NY','PA','VA','DC')
OPENQUERY method works perfectly.

How to restore SQL Server 2008 R2 backup to a LocalDb 2012

I have a backup of a database (.bak) created ​​in SQL Server 2008 R2.
To test some features, like to import this backup to LocalDB (2012).
When I click on Restore and select the database the following error occurs:
Property MasterDBLogPath is not available for Information 'Microsoft.SqlServer.Management.Smo.Information'. This property may not exist for this object, or may not be retrievable due to insufficient access rights. (Microsoft.SqlServer.Smo)
You need to add the following 3 registry keys (run/regedit):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11E.LOCALDB\MSSQLServer\DefaultData,
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11E.LOCALDB\MSSQLServer\DefaultLog,
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11E.LOCALDB\MSSQLServer\BackupDirectory
With an existing folder name as value (where you have write access), e.g. "C:\Databases".
Please have a look at the excellent walkthrough under http://www.roelvanlisdonk.nl/?p=2896 (which is where I have copied the answer from).