|
| |||||||||
| Tags: dbcc traceon, permission, sql, sql server 2005 |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| User does not have permission to run DBCC TRACEON
I have a huge database build under Microsoft SQL Server 2005. I recently faced a major problem when running certain queries in it. Whenever I run a query to get connected and retrieve data from the database, I have the following error message: Quote:
|
|
#2
| ||||
| ||||
| Re: User does not have permission to run DBCC TRACEON
Are you trying to set a traceflag when retrieving the data? If so, then I suppose you don't need to trace flag. Actually, to set the trace flags you need to be a sysadmin privileges. So it certainly is not possible. If you really want to do so then use some different method for getting data. |
|
#3
| ||||
| ||||
| Re: User does not have permission to run DBCC TRACEON
It is the problem of application name which you may have used. To resolve this problem, just change the name of the application for the ODBC connection. Ideally the name used should be other than 'Microsoft Query'! |
|
#4
| ||||
| ||||
| Re: User does not have permission to run DBCC TRACEON
To run DBCC Traceon, you require sysadmin rights. You can also programmatically change the connection string using the below example: Code: 'ChangeConnection
Sub ChangeConnection()
Dim sh As Worksheet
Dim qt As QueryTable
Dim sConnection As String
For Each sh In ActiveWorkbook.Sheets
For Each qt In sh.QueryTables
'Show current connectionstring
MsgBox ("Tab: " & sh.Name & vbCr & " Current Connection: " & vbCr & qt.Connection)
'Show current query
MsgBox ("Tab: " & sh.Name & vbCr & "Current Query: " & vbCr & qt.CommandText)
'Change Connection
qt.Connection = "ODBC;DRIVER=SQL Server;SERVER=myserver;DATABASE=myDB;Trusted_Connection=Yes;APP=Excel_TopCustomers;"
'Change Qry text (the owner for instance)
qt.CommandText = Replace(qt.CommandText, "DB.dbo.", "DB.Me")
qt.SavePassword = False
'Show new connectionstring
MsgBox ("Tab: " & sh.Name & vbCr & "Connection: " & vbCr & qt.Connection)
'Show new query
MsgBox ("Tab: " & sh.Name & vbCr & "Query: " & vbCr & qt.CommandText)
Next qt
Next sh
End Sub |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "User does not have permission to run DBCC TRACEON" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Making permission for normal user in Linux | Disha N | Operating Systems | 4 | 27-12-2010 10:56 AM |
| Mstsc /console user permission | Admin | Active Directory | 3 | 06-01-2010 04:29 PM |
| User permission | sureshpalani | Active Directory | 3 | 15-12-2009 03:00 AM |
| Permission for user | Asghar | Operating Systems | 1 | 16-10-2009 12:13 PM |
| Granting Read Permission to Application Instead of User | Tom Bombadil | Windows Security | 8 | 04-05-2009 10:32 PM |