PDA

View Full Version : Creating Functions


PGScannell
05-27-2010, 02:11 PM
I just created a function in my database, however I don't seem to have permissions to run it.

What do I do??

Thanks in advance,
Jerry

PGScannell
05-27-2010, 02:29 PM
My function references the view: sys.dm_exec_connections
which for some reason is off-limits to me even though it shows up as a system view.

Here is the code I am trying to execute. If someone knows what we need to do to allow me access to the view, let me know:

CREATE FUNCTION [dbo].[GetCurrentIP] ()
RETURNS varchar(255)
AS
BEGIN
DECLARE @IP_Address varchar(255);

SELECT @IP_Address = client_net_address
FROM sys.dm_exec_connections
WHERE Session_id = @@SPID;

Return @IP_Address;
END

Thanks in advance,
Jerry

dmitri
05-27-2010, 06:44 PM
Querying Dynamic Management Views is not allowed in our shared hosting environment for the security reason.