Solved

table-valued function

Posted on 2008-06-16
10
480 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
ID: 21796137
You can create the function, right click ->Properties->Permissions-> add the user who needs permissions.
0
 

Author Comment

by:takia1977
ID: 21796275
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
ID: 21796287
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
ID: 21796391
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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

Author Comment

by:takia1977
ID: 21796449
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]
ID: 21796569
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
ID: 21796612
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
ID: 21796893
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
ID: 21797029
yes, you can specify the DEFAULT SCHEMA for the user:
http://msdn.microsoft.com/en-us/library/ms190387.aspx
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Server Remove all trailing commas 10 71
Parsing the XML data to SQL Server 4 59
Grid querry results 41 72
SQL Backup skipping a few tables 7 36
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

14 Experts available now in Live!

Get 1:1 Help Now