Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

SQL Query return different result for different user

 
   Database Forums (Home) -> MSEQ RSS
Next:  Code readability vs. execution time  
Author Message
Anhtq

External


Since: Sep 04, 2007
Posts: 2



(Msg. 1) Posted: Tue Sep 04, 2007 2:58 am
Post subject: SQL Query return different result for different user
Archived from groups: microsoft>public>sqlserver>mseq (more info?)

Hi,

I have a query who returns different result for different user.
This query is just a "SELECT" from a view (or a function), like this:

Select * From MyList('12345', '67890')

When I logged in as "sa", it returns > 3000 lines (this is the number
expected)
When I logged in as "BUILTIN\Administrator", it returns only 17 lines !!!

Is there someone who knows how to correct this problem ?

Thanks.

 >> Stay informed about: SQL Query return different result for different user 
Back to top
Login to vote
Russell Fields

External


Since: Feb 21, 2007
Posts: 457



(Msg. 2) Posted: Tue Sep 04, 2007 10:40 am
Post subject: Re: SQL Query return different result for different user [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Anhtq,

Is the BUILTIN\Administrators group a sysadmin on your server? If so, then
rights should not be an issue. If not, then try to determine what your
function uses to which the BUILTIN\Administrators have no rights.

The code of your function might suggest why you are having this problem, but
there is nothing inherent to SQL Server to simply explain what you are
seeing. For example:

1. The code builds us a temporary from several selects before returning the
results. One of the intermediate selects needs rights that not all users
have.

2. There is some part of the function that is aware of something about the
logins. For a simple example:

WHERE is_member ('SpecialRole') = 1

RLF

"Anhtq" wrote in message

> Hi,
>
> I have a query who returns different result for different user.
> This query is just a "SELECT" from a view (or a function), like this:
>
> Select * From MyList('12345', '67890')
>
> When I logged in as "sa", it returns > 3000 lines (this is the number
> expected)
> When I logged in as "BUILTIN\Administrator", it returns only 17 lines !!!
>
> Is there someone who knows how to correct this problem ?
>
> Thanks.
>

 >> Stay informed about: SQL Query return different result for different user 
Back to top
Login to vote
Anhtq

External


Since: Sep 04, 2007
Posts: 2



(Msg. 3) Posted: Tue Sep 04, 2007 10:40 am
Post subject: Re: SQL Query return different result for different user [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thanks for your answer.

1. BUILTIN\Administrators is in the group sysadmin. So I think it's not a
problem of rights.
2. The function is a simple query, in which I'm sure that there isn't
criteria on login.

By the way, I've corrected this problem by:
- Delete the login BUILTIN\Administrator from the list of login of database
server.
- Recreate this login
(and of course some restart of server between whiles)

I thought about problem of cache or something like that, but before carrying
out these actions above, the clear of cache haven't had any effect.

Someone has any idea ?
 >> Stay informed about: SQL Query return different result for different user 
Back to top
Login to vote
Russell Fields

External


Since: Feb 21, 2007
Posts: 457



(Msg. 4) Posted: Wed Sep 05, 2007 2:59 pm
Post subject: Re: SQL Query return different result for different user [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Anhtq,

Well, your problem is solved. Deleting and readding a login, as well as
rebooting it, have had several opportunities to fix something that was not
quite right. It certainly is not a SQL Server caching issue (or at least I
am pretty certain that it is not), but domain to SQL Server changes may have
some caching latency depending on the version of SQL Server, Windows, your
domain controllers, etc, etc.

I would say that if the problem arises again, you could repost at that time.

RLF

"Anhtq" wrote in message

> Thanks for your answer.
>
> 1. BUILTIN\Administrators is in the group sysadmin. So I think it's not a
> problem of rights.
> 2. The function is a simple query, in which I'm sure that there isn't
> criteria on login.
>
> By the way, I've corrected this problem by:
> - Delete the login BUILTIN\Administrator from the list of login of
> database
> server.
> - Recreate this login
> (and of course some restart of server between whiles)
>
> I thought about problem of cache or something like that, but before
> carrying
> out these actions above, the clear of cache haven't had any effect.
>
> Someone has any idea ?
 >> Stay informed about: SQL Query return different result for different user 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Combining result sets - Hi there, In an effort to give you a clear idea of what I'm doing, I'm going to give you as much info as possible. Hopefully, this isn't overkill... Background: I have 2 select statements which both count the number of units of products ordered and...

it maybe a wrong return value - There is a sql function like this below: Create Function dbo.abc (@ParamOne decimal, @ParamTwo decimal) RETURNS Bit AS BEGIN DECLARE @Result bit if abs(@ParamOne-@ParamTwo)<0.01 SET @Result=1 else ...

Return single line - What I am looking for is to read a file that has three columns to it and return the lastest part number with the newest date. part Number Date QTY 2534 100102 20 2534 100505 24 2534 092104 95 2534 ...

Problem getting return value from master.dbo.xp_cmdshell - Hi, I'm having an issue getting a value returned from master.dbo.xp_cmdshell into a stored procedure. The exe I'm running combines two files and returns a numeric value if successful and if there is a wrong paramter, it returns an error line ala ..

Get user syntax - I am building a view for a report and one of the requirements is to grab the user who is running the report. What would this syntax look like? I thought it was getuser(), but no luck there. Thanks, Ryan
   Database Forums (Home) -> MSEQ All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]