Solved

table-valued function

Posted on 2008-06-16
10
482 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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
 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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 restarts itself 6 38
Not selecting duplicate data 6 55
Passing value to a stored procedure 8 100
Email Notifications for SQL 2005 9 28
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…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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