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

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

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

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :Sql Server


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(

View Complete Post

More Related Resource Links

Find SQL Query when report is executed

Hi All, I am using SSRS 2008 R2 verison of reporting services. I have a report and the data source for this report is Oracle 10i, it takes around 2 mins to execute the report. I want to find out the query, which is sent by the reporting services to the Oracle. Is there a way to find it out. Please help me with this. Thanks Vineeshvineesh1701

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


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.

Is there any way to find out the reason for session expiry?


Dear All,

is there any way to find out the reason for session expiry?



query string or session variable or neither for this scenario?

Hello,example scenario: user login has a list of associated 'accounts' it has access to... this list of accounts is stored in a database table, say tblAccountAccessControl, something like:login, accountID-----------------------userA, account123userA, account456userA, account798userB, accountABCuserB, accountDEFetc..this info is used throughout the web application and determines the 'domain' of information the particular login has access to. For example there are many other tables that have the 'accountID' field and whenever a page pulls data from the table it only pulls data that the currently logged in user should be allowed to see, based on that tblAccountAccessControl data.the security question:1) do I need to query the database every time I need to get this list of allowed accountID's? I was about to use a plain old query string to pass a particular accountID to another page but quickly caught myself as I realized that would be a major security flaw (the receiving page was going to use that accountID to grab info from the database, and there would be nothing preventing a user from simply typing in a url manually to get data from an accountID they are not supposed to be allowed to view). So I then thought I'll just store the list of accountID's in a session state variable so they will be carried with the user throughout the sessi

session solution query

Hi, I have used this line to avoid an error of   <pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode="Never" enableViewStateMac="false">  Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.   It works but are there side effects and what does this do? I didnt understand why i get this error and how this works.  

how can a query be executed in vs2010 ?

I work on a project labregistrations for students in VS2010 using vb i have a table in my db called registration and i want to put values (data) in it through this query.How can this be executed? Any code help please?   sqlstr As String = "INSERT INTO REGISTRATION (AcademicSemId,AcademicYearId,LabId,StudentId,RegDate) VALUES (" & Session("AcademicSemId") & "," & Session("AcademicYearId") & "," & lab.LabID & "," & Session("StudentId") & "," & Now.Date.ToString

Please help me to find out distinct value from linq to sql query given.

profileuserDataContext db = new profileuserDataContext(); var Q = (from p in db.edufinals join RM in db.edufinals on p.UserName equals RM.UserName where p.name.StartsWith(srcval) select new { p.name, RM.ProfielID, RM.ProfielPic, RM.city }).OrderBy(x => x.name).Distinct().Take(10);//, p.Key.ProfielID, p.Key.ProfielPic, p.Key.city, p.Key.country foreach (var pg in Q.Distinct()) { Response.Write(pg.name); ..................................... .................................... } how to refine this query to get distinct "name" column? Please help me to find out exact value.

How to find specific nested object type in Gridview

Dears, I have a gridview with a nested placeholder in each rows. I nested some checkboxes in each placeholders in each rows dynamically, so their ServerIDs are not the same (I dont want to use nested gridview). at the end in a button event I want to count checked checkboxes in gridview while I can not use findcontrol() method in each rows to find checkboxes due to their different ServerIDs. How can I do this?

How to get one specific row to be the last row returned from a query?

 I have a table of skills.  In that table, are rows of data with various skill type.  I need to return a list of those skills in alphabetical order, with one exception.  The skills "General" can't be listed in the "G's", instead, it needs to be the last item.  (Crazy, I know, but it's to discourage users from settling on a selection of "General".  This statement returns all the skills in alphabetical order, but "General" is listed right in the middle with other "G's:SELECT SkillsID, Skill, SkillDesc FROM tSkills  ORDER BY Skill

MDX query to filter on specific dimension attributes

Ok, trying to figure out how to filter on specific dimension attributes. Are there any suggestions? I have a measure that needs to be filtered by a dimension that has numerous attributes (20 attributes in total) but I only want to show that measure against 10 of the attributes and once I get that result I need filter that result set against my time dimension (which this part I have figure out)   This is what I have so far: With member [calculated_measure_name] as ( [measures].[count_of_people], { [dimelgiblestatus].[elgible].[elgible1], [dimelgiblestatus].[elgible].[elgible2], [dimelgiblestatus].[elgible].[elgible3], [dimelgiblestatus].[elgible].[elgible4], [dimelgiblestatus].[elgible].[elgible5], [dimelgiblestatus].[elgible].[elgible6], }   )   Select [calculated_measure_name] on columns, [date].[fsicalyear].&[2008], [date].[fsicalyear].&[2009], [date].[fsicalyear].&[2010], [date].[fsicalyear].&[2011] on rows from mycube   When I run it, it gets no errors but in the result set for the numbers I get "#error"; do I need to basically create a subcube in order to get the result like I would like? If so how would I start doing that?   ThanksNetwork Analyst

MDX Query - Find only new item that purchased in the last day or during the last week

Hi to all I whould like to write a MDX query to get new items that purchased in the last day and not purchased in the last 7 days or 30 days  , Also to find new items that purchased in the last 7 days and not purchased in the last 30 days , this is what i done until now CREATE   SET CURRENTCUBE.[FindNewWordIn_1_Day]   AS Filter   (nonempty([Keyword].[Keyword Name].members, ([Measures].[Count keyword],   NONEMPTY (Tail( Filter( [Time].[Date].MEMBERS ,   Not IsEmpty ([Measures].[Count keyword]) ), 1) ))) ,([Measures].[Count keyword], [Time].[Date].&[2010-09-10] )=0);   The value of [Time].[Date].&[2010-09-10] should be change to period that i want to check , ( 1 day, 7 day , 30 day)   the other one is lateset day with value NONEMPTY (Tail( Filter( [Time].[Date].MEMBERS , Not IsEmpty ([Measures].[Count keyword]) ), 1) with for you help ,   ofer  

VWD 2010 and Linq to Sql: can't find a query model for...



I have added a linq to sql layer in my MVC 2 application.

This is the code I am using:

using (ProductPortalDataContext ctx = new ProductPortalDataContext())
                var Title = from aps in ProductPortal.Models.AppSettingsView
                            where aps.LanguageID = Lang
                            select aps.WebSiteTitle;

It says to be unable to find a quey model for AppSettings view and then says "where not found".

Tried googling, nothing came up. Tried searching here(first two pages) and nothing that seemed relevant popped up.

But the best of all, created a new ASP.NET applicatio, imported the model using Linq to SQL and it compiled!

No idea what I am doing wrong... hints?

(some time later...)

Ok, I tried adding a button and a label to the asp.net application j

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?


Custom search to document library to find specific document



I have a document library with having multiple folders approx 100 (001 to 100) , each folder is having multiple document ,Every folder in that document library contains 50000 documents , Document library has some fileds like Fname, Lname,Document Type [Look up field] having value(Genral,Average,Advance) . now the problem is to search these documents with using custom search as per requirement

the user wants a webpart where it has 2 textbox [FName and LName] and a dropdown [Document type] and a button , using this the user can enter the first name , last name and selecting document type from the dropdown and finally clicking the search button filters the document library. 

my problem is with that how the value of this search criteria can be passed to the Document library.How these webpart can be connected with custom search or do we have any other way to search.




Top query for a particular session.

In SQl Server 2005, Please let me know how can I get the top sql_text or sql_plan for a particular session.  I see the sys.dm_exec_query_stats has the sql runtime details but doesn't have which session it came from. I need to isolate batch from online

Incremental processing - do I need to provide specific query?



I have read a few thread on this subject but I didn't get a clear understanding on how incremental processing works.

My question is.. I have a Fact view with with TimeID,Computerid as primary keys. I would expect when I do an incremental processing that SSAS figure out for which keys the cube doesn't have data and insert the missing ones. However, it looks like you have to specify the query to determine the data that should be incremented in the cube, is that right?

How could I do then if my TimeID isn't populated sequentially? For instance, I could write a query to get only today's data but it's very possible that tomorrow or the day after there are still some late rows being inserted with todays timeID but at that time my query would miss these rows. Please let me know if the explanation is a bit confuse.


find situation about a query that it is executing now

Hi all. I am a c# programmer. I have a update query that it need 2 minutes for executing (for each reason). I don't want discuss about its performance. My question is: How can I find situation about a query that it is executing now and it has not executed completely yet. for example How can find my c# code how many records are affected by my query every 10 seconds while that query is executing? Is sql profiler says that to us?
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