Solved

table-valued function

Posted on 2008-06-16
10
479 Views
Last Modified: 2009-12-16
Is there a way to run a table-valued function with a predefined user?  
0
Comment
Question by:takia1977
  • 4
  • 3
  • 2
10 Comments
 
LVL 8

Expert Comment

by:sbagireddi
Comment Utility
You can create the function, right click ->Properties->Permissions-> add the user who needs permissions.
0
 

Author Comment

by:takia1977
Comment Utility
This is the error message I am getting. I want the user to be able to run this without adding them the to table this function is using.  I was hopeing that I would be able to do this by predefining a user for this function to always execute as.

SELECT *
FROM func_GetUserInfo_FromLogin('tajohnson', DEFAULT)

Msg 7314, Level 16, State 1, Line 1
The OLE DB provider "SQLNCLI" for linked server "SCFDB01" does not contain the table ""Rosetta"."dbo"."RosettaStone"". The table either does not exist or the current user does not have permissions on that table.

0
 
LVL 8

Accepted Solution

by:
sbagireddi earned 43 total points
Comment Utility
Looks like you will need to give permissions to the user for the table.
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 86 total points
Comment Utility
that functions must be CLR function?
note: functions must be called, AFAIK, with their schema perfix?



SELECT *
FROM dbo.func_GetUserInfo_FromLogin('tajohnson', DEFAULT)

Open in new window

0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:takia1977
Comment Utility
I am not sure what you mean by AFAIK?  I am pretty new to this whole thing.  As far as the schema prefix wouldnt that be the dbo part of the function name?  If I run the same select statement with my user account it works fine.  I think this is because I have permissions to the table.  
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
AFAIK = As Far As I Know :)

> If I run the same select statement with my user account it works fine.
you might have 2 "versions" (under different schema) of the same function name.
0
 

Author Comment

by:takia1977
Comment Utility
Sorry, I just realized that I dont have the schema prefix in the original query that I sent.  But, I am still able to run the statement without the prefix.
0
 

Author Comment

by:takia1977
Comment Utility
There is not another version.  Do you know of a way that I setup a defualt user for the Function to run as?  
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 86 total points
Comment Utility
yes, you can specify the DEFAULT SCHEMA for the user:
http://msdn.microsoft.com/en-us/library/ms190387.aspx
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now