Identify SQL Server version

Some TSQL command to identify the version of SQL you are running:

SQL Server 6.5
SELECT @@VERSION

Version Number

Service Pack

6.50.479

SQL Server 6.5 Service Pack 5a (SP5a) Update

6.50.416

SQL Server 6.5 Service Pack 5a (SP5a)

6.50.415

SQL Server 6.5 Service Pack 5 (SP5)

6.50.281

SQL Server 6.5 Service Pack 4 (SP4)

6.50.258

SQL Server 6.5 Service Pack 3 (SP3)

6.50.240

SQL Server 6.5 Service Pack 2 (SP2)

6.50.213

SQL Server 6.5 Service Pack 1 (SP1)

6.50.201

SQL Server 6.5 RTM


SQL Server 7.0
SELECT @@VERSION

Version Number

Service Pack

7.00.1063

SQL Server 7.0 Service Pack 4 (SP4)

7.00.961

SQL Server 7.0 Service Pack 3 (SP3)

7.00.842

SQL Server 7.0 Service Pack 2 (SP2)

7.00.699

SQL Server 7.0 Service Pack 1 (SP1)

7.00.623

SQL Server 7.0 RTM (Release To Manufacturing)

SQL 2000
SELECT SERVERPROPERTY(‘productversion’), SERVERPROPERTY (‘productlevel’), SERVERPROPERTY (‘edition’)

Release

Sqlservr.exe

RTM

2000.80.194.0

SQL Server 2000 SP1

2000.80.384.0

SQL Server 2000 SP2

2000.80.534.0

SQL Server 2000 SP3

2000.80.760.0

SQL Server 2000 SP3a

2000.80.760.0

SQL Server 2000 SP4

2000.8.00.2039

SQL 2005
SELECT SERVERPROPERTY(‘productversion’), SERVERPROPERTY (‘productlevel’), SERVERPROPERTY (‘edition’)

Release

Sqlservr.exe

RTM

2005.90.1399

SQL Server 2005 Service Pack 1

2005.90.2047

SQL Server 2005 Service Pack 2

2005.90.3042

SQL Server 2005 Service Pack 3

2005.90.4035

SQL 2008
SELECT SERVERPROPERTY(‘productversion’), SERVERPROPERTY (‘productlevel’), SERVERPROPERTY (‘edition’)

Release

Sqlservr.exe

RTM

2007.100.1600.0

SQL Server 2008 Service Pack 1

2007.100.2531.0

SQL Integration services: “Access is denied” when running SSIS package

We had a problem with executing a SQL Job which runs a SSIS Package. Whenever the job started we would get the following error:

Executed as user: <domain>\<user>. Microsoft (R) SQL Server Execute Package Utility  Version 10.0.1600.22 for 64-bit  Copyright (C) Microsoft Corp 1984-2005. All rights reserved.    Started:  09:13:01  Error: 2009-08-05 09:13:02.85     Code: 0xC002F304     Source: <source> from SFTP Execute Process Task     Description: An error occurred with the following error message: "Access is denied".  End Error  DTExec: The package execution returned DTSER_FAILURE (1).  Started:  09:13:01  Finished: 09:13:03  Elapsed:  1.843 seconds.  The package execution failed.  The step failed.

The package was executing a batch file which in his turn starts an SFTP connection and downloads some files.
It seems that it has all to do with the fact that we are running on a x64 bits server with x64 SQL Server.

To resolve the problem open the job and then edit the job step. Next click on the Execution Options Tab. Finally enable the “Use 32 bit runtime” option. This should resolve your problem.

SQL Job Properties

Weird thing is, that when the owner of the job is a local administrator, the job will not fail and will execute properly.

More information can be found here and here.

SQL: Microsoft SQL Server, error:916

I created a SQL User named UserA which was DB_Owner of 1 database. When I connected to this database with SQL Authentication I received the following error:

The server principal “User A” is not able to access the database “DatabaseA” under the current security context. (Microsoft SQL Server, error:916)

image

To resolve this error I logged in as SQL User UserA, and open theVObject Explorer Details View (press F7). I then right Clicked on the column header and de-selected ‘Collation’. Refresh your databases again and now it should work.

SQL Query to identify Kerberos or NTLM connection

SELECT
    s.session_id,
    c.connect_time,
    s.login_time,
    s.login_name,
    c.protocol_type,
    c.auth_scheme,
    s.HOST_NAME,
    s.program_name
FROM sys.dm_exec_sessions s
JOIN sys.dm_exec_connections c
ON s.session_id = c.session_id

 

A query to see if a connection is made with Kerberos or NTLM.
login_name together with host_name and program_name will identify the login.
auth_scheme will reflect what security protocol was used