Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

table-valued function

Posted on 2008-06-16
10
483 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 143

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 143

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 143

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Impove long SQL Stored Procedure Performance 14 78
CROSS APPLY 4 56
Need a SQL query that creates a header row and one or more detail rows. 7 51
tempdb log keep growing 7 33
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…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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