Msg 7415, Level 16, State 1, Line 1. Ad hoc access to OLE DB provider ' MSDASQL' has been denied.

by John 27. January 2011 08:45

Unless you are an 'sa' you probably will get this error.

Fix it by adding this setting to the registry.

Value Data
DisallowAdHocAccess 0

 

--
-- Quickly check your registry settings running this on SQL 2005+ servers

EXEC master..xp_regenumvalues 
                        'HKEY_LOCAL_MACHINE',
                        'SOFTWARE\Microsoft\Microsoft SQL Server\<instance>\Providers\MSDASQL'

-- or on SQL 2000

EXEC master..xp_regenumvalues 
                        'HKEY_LOCAL_MACHINE',
                        'SOFTWARE\Microsoft\MSSQLServer\Providers\MSDASQL\'

Categories: ERRORs | SQL Server

How to remove Reporting Services from SQLServer 2008 R2

by John 27. October 2010 04:48

1.In Add/Remove programs
2.Click the 'Uninstall/Change' button for "SQL Server 2008 R2"
3.In the coming dialog, click 'Remove'
4.Click 'OK'
5.In the 'Select Instance' dialog,  select the appropriate instance of the SQL Server (!) and then click 'Next'
6.In the 'Select Features' dialog, please only select 'Reporting Services'
7.Then click 'Next' and 'Next' till the uninstalling process starting

Step 6

 

Step 7

Tags:
Categories: SQL Server

PowerShell and why I will learn it.

by John 4. August 2010 07:14

Up until SQL Server 2008, I didn't need PowerShell to manage my dozen servers and know exactly what was going on. Now I do.

And the benefits and capabilities are plentiful! You can start to be convinced by reading this article, "Why This SQL Server DBA is Learning Powershell", brilliantly conceived.

Next, use this site as a resource and examples.

Here is a great set of examples by MAK.

Categories: PowerShell | SQL Server

Granting ASP.NET web application access to run procedures in SQL

by John 13. July 2010 02:28

USE MyDatabase
GO

-- Windows 2000 / XP
-- Replace "{servername}" with your SQL Server name

EXEC sp_grantlogin [{servername}\ASPNET] 
EXEC sp_grantdbaccess [{servername}\ASPNET], [NETAPP]

-- GRANT EXECUTE ON [ProcedureName] TO [NETAPP]
grant exec on [dbo].[usp_My_Procedure] TO NETAPP 
GO

-- Windows Server 2003
-- Info.

EXEC sp_grantlogin [NT AUTHORITY\NETWORK SERVICE]
EXEC sp_grantdbaccess [NT AUTHORITY\NETWORK SERVICE]

GRANT EXECUTE ON [ProcedureName] TO [NT AUTHORITY\NETWORK SERVICE]
GO

Categories: SQL Server | WEB

A good article on SQL Transactions

by John 11. May 2010 08:28
Tags:
Categories: SQL

Open DBDiff - a viable alternative?

by John 24. March 2010 02:46

Get it here.
Tags:
Categories: SQL

Msg 1934, Sev 16: UPDATE STATISTICS failed because the following SET options have incorrect settings: 'ARITHABORT'.

by John 17. March 2010 06:34

Got this when I ran my sp__updatestats procedure in a SQL Agent jobstep, but it worked in Query Analyzer. The reason? The default settings are probably different in QA rather than external connections similar to SQL Agent.

Msg 1934, Sev 16: UPDATE STATISTICS failed because the following SET options have incorrect settings: 'ARITHABORT'. [SQLSTATE 42000]

The solution was to recreate the procedure that ran UPDATE STATISTICS using a SET command within the procedure. 

CREATE PROCEDURE dbo.sp__UpdateStats
AS
SET 
ARITHABORT ON 
SET 
QUOTED_IDENTIFIER ON 
...

We started to get this problem after I added a computed column to a table. 

Tags:
Categories: ERRORs | SQL | SQLAgent

Getting started in SSIS dynamic packages

by John 4. March 2010 06:23

Finally getting around to replacing our DTS ActiveX scripts that make DTS Packages dynamic. Passing in variables on command line, allowed us to change our source, destination, remap transformations etc.

Getting started in SSIS.

1) Start with this list of Best Practices.
2) Follow this link to a great tutorial about using SSIS control flow script task.

 

Tags: ,
Categories: SQL | SSIS

Links to help explain RAID

by John 1. February 2010 10:49
Tags:
Categories: Files | SQL Server | WINDOWS

Use COALESCE to put a column of data into a delimited list variable

by John 31. December 2009 01:41

Here's an example of how to create a delimited list, using a field of rows of data and COALESCE.

CREATE TABLE #tmp (ID INT IDENTITYValue VARCHAR(10))

INSERT #tmp (ValueVALUES(@@IDENTITY)
INSERT #tmp (ValueVALUES(@@IDENTITY)
INSERT #tmp (ValueVALUES(@@IDENTITY)
INSERT #tmp (ValueVALUES(@@IDENTITY)
INSERT #tmp (ValueVALUES(@@IDENTITY)
INSERT #tmp (ValueVALUES(@@IDENTITY)
INSERT #tmp (ValueVALUES(@@IDENTITY)
INSERT #tmp (ValueVALUES(@@IDENTITY)
INSERT #tmp (ValueVALUES(@@IDENTITY)
INSERT #tmp (ValueVALUES(@@IDENTITY)

DECLARE @vcList VARCHAR(100)
SELECT @vcList COALESCE(@vcList ';''')
ISNULL(Value'0')
FROM #tmp
-- ORDER BY might not work
PRINT @vcList

Resulting in:
10;1;2;3;4;5;6;7;8;9

NOTE:
Don't be surprised when ORDER BY doesn't work.  

'SQL Server query processor builds an different execution plan when expressions are applied to columns in the query's ORDER BY clause, than when those same expressions are applied to columns in the query's SELECT list. The decision made by the query processor is based on the cost of possible execution plans.'

Tags:
Categories: SQL