Posted - 11/24/2004 : 04:53:50
I am using the very good crosstab-procedure, but I have problems to run the procedure without sysadmin-rights. Normal Users get the message
"Server: Msg 156, Level 15, State 1, Line 1
Falsche Syntax in der Nähe des END-Schlüsselwortes."
So I tried to debug it in QA. It seems, that normal users can create and drop the temp-table.
The statement that creates the problem is
/* This statement doesn't work with "normal" User, only with sysadmin !! */
SELECT @sql=@sql + '''' + convert(varchar(100), pivot) + ''' = ' +
stuff(@sumfunc,charindex( '(', @sumfunc )+1, 0, ' CASE ' + @pivot + ' WHEN '
+ @delim + convert(varchar(100), pivot) + @delim + ' THEN ' ) + ', ' FROM ##pivot
The variable @sql contains after execution of this statement with sysadmin-right something like this:
'\\s065301f\swmgmt' = min( CASE ServerShare WHEN '\\s065301f\swmgmt' THEN Drive END), ....
without sysadmin-right it contains only
'\\s065301f\swmgmt' = min(Drive END), ....
Can anyone help, why the statement did not work like expected?