How to call an extended procedure from a function

Posted by Alan Featherston Lago on Stack Overflow See other posts from Stack Overflow or by Alan Featherston Lago
Published on 2010-03-10T16:39:06Z Indexed on 2010/03/14 10:05 UTC
Read the original article Hit count: 312

hi im having trouble trying to get the following function to work.

CREATE FUNCTION test ( @nt_group VARCHAR(128) )
RETURNS @nt_usr TABLE (
      [name] [nchar](128) NULL
    , [type] [char](8) NULL
    , [privilege] [char](9) NULL
    , [mapped login name] [nchar](128) NULL
    , [permission path] [nchar](128) NULL
    )
AS BEGIN 

    INSERT  INTO @nt_usr
    EXEC master.dbo.xp_logininfo 'DOMAIN\USER', @nt_group
     RETURN
   END

As far as i know i should be allowed to call an extended stored procedure, im getting the following error

Mes 443, Level 16, State 14

Could it be that xp_logininfo might return different result sets depending on the parameters? When i use openquery i can overcome this by setting this: SET FMTONLY OFF. Does anyone know if there's a similar workaround for my problem?

© Stack Overflow or respective owner

Related posts about sql-server-2005

Related posts about tsql