.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How can I find from a single query that a user has which permission on a specific table

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :

Hi All,

How can I find from a single query that a user  has which permission on a specific table. I have a Table named "Property_Address" and a User "ABC" doing update on this table. How can I revoke permissions on this table from this user and how can I find which permissions this user have on Property_Address Table.

Any help would be appreciate.

View Complete Post

More Related Resource Links

Tricky SELECT query from a Single Table

Hi I have a 2 rows of data in a table as mentioned below   Table1             ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 NULL 40 NULL 20 4 9 2010 400 NULL 200 NULL  I need a SELECT query to get the output in a single row as ElementID Month Year Planned Cost UnplannedCost PlannedExpense UnPlannedExpense 4 9 2010 400 40 200 20 Could anybody help me in writing a query for this? Thanks

SPView query to find if the current user belongs to a Group


HI All,

I´m trying to write a query for a list view that should return all items if the current user belong to a group. If the user doesn´t belongs to this group, no items should be returned.

So far, I could find many equal examples about using the CAML Membership element in a comparison with an AssignetTo field. But not making a comparison between the current user and a specific Sharepoint Group.

Any suggestions, please?


How do find what query is being executed on specific session ID?



I have a SP which writes to a table all processes which are being executed when application decides to stop waiting for results of the query. It works very well but problem is that it does not dump all SPIDs but only some of them which are being executing for a long time. Common pattern that a lot of SPIDs will be blocked by single SPID which will not be part of the output which is being generated. How do I dump all SPIDs and what they are doing along with SP below?


 'blk object' = t1.resource_associated_entity_id,

 (SELECT SUBSTRING(text, t3.statement_start_offset/2 + 1,
 		(CASE WHEN t3.statement_end_offset = -1 
 			THEN LEN(CONVERT(nvarchar(

Find all stored procedures/functions granted to a specific user


SQL 2005.

How can I find all routines (sp, fn) exec granted to a specific user in a given database ?

Thanks !!

How to Find a specific sentence in a table that contains only words?


Hello dear grurus,

I don´t know if my question did, somehow, explain itself... if not, let me brake it down:

I have a table like this:

ID         WORDS

1          change color red

2          open door

3          find terms


now, I would like to search for an ID giving this search string: "Whould you like to change the color to red, please?"

please notice I have given a sentence containing 3 keywords found in row 1 for the table above... I know this, but how do I make t-sql to know this? 


Thank you so much for the help guys!

PS: please let me know if im not clear enough.

CAML query to check if user is member of a specific group


I've got a nested query caml which basically should check 3 things:

  1. Check if a task has been assigned directly to the ucrrent user
  2. Check if a task has been assigned to a group the user is in
  3. Check if the user is member of a specific

The first to bullet points work like a charm, but I can't figure out how to get the last one to work. Here is what I thought should work:

query += "<Where>";
query += "<Eq><Membership Type=\"CurrentUserGroups\">";
query += "<Value Type=\"String\">Name of my specific group</Value>";
query += "</Membership></Eq>";
query += "</Where>";

Somehow it doesn't seem to be the correct approach, is there somebody who can help me out on this? Thanks

Query table from within CLR function where the db user has not select right on the table


I have written a CLR scalar valued function that queries a table using the context connection. This is working fine as long as the db user has select right on the table that is queried from within the CLR function. If the db user has no select right on the table I am receiving the following error:

The SELECT permission was denied on the object '...', database '...', schema 'StD'.

I do not want to give the user select right on the table. How can I allow the CLR function to query the table without granting select right to the db user?

I have created the assembly with PERMISSION_SET = SAFE. Do I have to apply PERMISSION_SET = UNSAFE or is there any other way?

Thanks and kind regards
Sebastian Daser
Softfount IT Solutions

merging multiple tables in a single dataset to single table


 i have a stored procedure which returns three tables to a dataset ..... now i need to merge all three tables to a single table from d same dataset 

like dataset1 has table1 table2 and table3 .... i want all the three tabels to be merged into dataset1 itself .... instead of three diffrent tables so that i can show all three table data in a single datagrid  as a compact data and combination of 3 tables from d single dataset.....

can some1 help me please.....

lookup table query


we are doing our cms migration. both cms's have their own articleID/contentID, we have a lookup table that contain the article URL and its content id.  Now we want to query that table on every single click to get its respective id. 

How and where i can implement this?

Error "user does not have permission to perform this operation" with User Instance = True.


I setup SQL Server 2005 / SQL Express. All works fine in SQL Server 2005.

I am connecting to a SQL Database from VS 2005,  Tools/Connect to Database. I set the Data Source to "Microsoft SQL Server Database File (SqlClient)" (meaning SQL Server Express) and User Instance = True, and Integrated Security = True.

The above is working successfully on all machines except my Laptop. On my Laptop, I am getting this error "user does not have permission to perform this operation". On my Laptop, if I change User Instance = False, it works fine. Also, If I connect to SQL Server 2005 it works fine only if User Instance = False.

I tried all kind of security changes, nothing worked. For example, I setup Everyone as Full Control for the Folder and the MDF File of SQL Server. I gave my user ID as sysadmin role in SQL Server Express. Also, I enabled creating User Instance form SQL Server Express, Nothing is working.

Appreciate your help.


=User!UserID from windows authentication using table from another database



i'm using sql server 2005, sql server business intelligence development studio for my reports and deploy them in my wss3.0 site.

what i'm trying to do is i'm trying to restrict wich users can see specific data within a report.

now, the thing is. the report gets the data out of my DB1 database and my windows authenticated user are in the WSS_content database.

when i deploy my report in my wss3 site. it gets the user that is loged in. but of course it does not display any data because the tables are not in the same database.

does someone knows how to do this?

Create Table from MDX query

Hi,I want create a table from the result of the MDX query. When I finish the wizard of import data in SQL Server Environment. at the last stage, the error is : Pre-execute (Error) Messages Information 0x4004300b: Data Flow Task 1: "component "Destination - Query" (31)" wrote 0 rows.(SQL Server Import and Export Wizard) please guid  me.Thank you a lot.Naeimeh

DTA doesn't find referenced table form stored procedure with SP_executesql

Using the SQL2008R2 profiler and DTA connected to a SQL2000 server. I created a tuning tracefile with profiler for a certain db on the sql2000 server because I need to tune 1 table in the database referenced by 3 parameterized stored procedures which built a query depending on the parameters and is executed with an sp_executesql statement. When I run the DTA loading the tracefile I see the exec stored procedure events with it's parameters and the message Event does not reference any tables. And that's it. The DTA generates no Recommendatioin at all. How can I get the exact sql statements in the tracefile so the DTA can do what he needs to do? Regards

Application to Constantly query Table Values and Refresh with most recent value

Hello, I must apologize in advance because I am not sure if this is the correct place for this question. I am looking for ideas on how to build an application that in the most basic sense contains a field with the most current data from a table in a SQL Server database (this would be based off of a datetime timestamp in the table). I am new to this kind of problem and am unsure where to start looking for solution ideas. The table value updates variably and could possibly update every second to every hour. I would like to design an application that would be lightweight to both the server and the user's machine. This would take the place of an unneeded report on my Reporting Services server. Any and all suggestions would be welcome because I am not sure of options I even have on this. Thanks in advance for your time and consideration, Matt

SQL User Permission (No answer found by searching)

Hello all!   I'm hoping someone will be able to answer my simple question!   Previously, I've run the below script to give one user access to their db in SQL management studio but nothing else. use [someDB] -- use the real db name go sp_changedbowner 'theUser' -- use the new username go 4. Next, deny the new user "public" access to ALL databases: use master go deny VIEW any DATABASE to theUser go   However I now need to add an additional user with view on permissions to the database and can't figure out how to do it. I'm sure it's simple but my SQL knowledge is at a low level.   Many thanks, Lee.

Transact-sql - tricky query to get a list of people from a table where i belong too.

I've no idea how to manage and optimize this query: I've four table. - User (userId, name) - Member (memberId, name, ownerId) The ownerId = user.userId - PresentPeople (activityId, presentId, ...) so presentId = memberId - Activity (activityId, ownerId, startDate...) and ownerId = user.userId So here for an user, I need members created by this user, and for this members I need the list of presentPeople for the activity that theyjoined. But I don't know how to get this list because they are in the list. Not sure if i'm clear there, Big help would be very helpfull :)) thanks
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend