am trying to add QUERYTRACEON 9481 to a dynamic query but i can not do so, as i can add the QUERYTRACEON 9481 to a store procedure however to a dynamic sql i can not add it as the user require higher rights to run the DBCC command, is there a work around
to fix it, as the application depends a lot on dynamic query. This is a sample script Currently the user have read and write access to the db and execute permission
Create procedure [dbo].[test]
as
declare @sql varchar(max)
set @sql = 'SELECT TOP 1000 [ID]
,[name]
,[street_addr]
FROM [test].[dbo].[test2] OPTION (RECOMPILE,QUERYTRACEON 9481) ' ;
EXEC (@sql)
GO
User 'test_user' does not have permission to run DBCC TRACEON.
can not depand on plan guide as am afraid it will affect the other ad-hocs
Create procedure [dbo].[test]
as
declare @sql varchar(max)
set @sql = 'SELECT TOP 1000 [ID]
,[name]
,[street_addr]
FROM [test].[dbo].[test2] OPTION (RECOMPILE,QUERYTRACEON 9481) ' ;
EXEC (@sql)
GO
User 'test_user' does not have permission to run DBCC TRACEON.
can not depand on plan guide as am afraid it will affect the other ad-hocs
Best Regards Moug