How To Capture The Query Run By An Appplication?

Apr 30, 2008



I'm new to sql server. Now I'm re-writing an application without any source code. I want to find out how the data is retrieved from the database. Can anyone give me any detail instructions or link to the documentation that tells this? There's no DBA here either.
Thanks.

View 1 Replies


ADVERTISEMENT

Query From Packet Capture

Apr 22, 2014

I'm trying to organize this SQL query from a packet capture and I'm more of a network/application guy, not so much of a DBA. To me it looks like they are using variables in their query and the "@" is a delimiter.

S E L E C T [ t 0 ] . [ S E C T I O N N A M E ] , [ t 0 ] . [ P A R A M E T E R N A M E ] , [ t
0 ] . [ I N T V A L U E ] , [ t 0 ] . [ S T R I N G V A L U E ] , [ t 0 ] . [ D A T E V A L U E ] , [ t 0 ] . [ I N F R A S T R U C T U R A L ]
, [ t 0 ] . [ S i t e P a r a m e t e r s I d ] F R O M [ d b o ] . [ S I T E _ P A R A M E T E R S ] A S [ t 0 ] W H E R E ( [ t 0
] . [ S E C T I O N N A M E ] = @ p 0 ) A N D ( [ t 0 ] . [ P A R A M E T E R N A M E ] = @ p 1 ) @ 4@ @ p 0 n v a r c h a r ( 3
) , @ p 1 n v a r c h a r ( 1 0 ) @ p 0 4 W e b @ p 1 4 M a x Q u e r i e s

[code]...

View 6 Replies View Related

Programtically Capture Query Runtime

Jul 20, 2005

What are some sound solutions to capture the query runtime via ascript/proc? The info returned from Statistics time is hard to process.The goal is to run a statement(s) and capture and track the executiontime to check on the availability of SQL Server. The data can beanalyzed to determine when perf is high and low. But the main reason isto check db availability.Thanks,Mike--Posted via http://dbforums.com

View 3 Replies View Related

How Can I Capture Update Query Session...

Nov 4, 2007

Hi guys,

A column in my table is being updated and I would like to find out what process, host, user, etc. is performing the update.

I have added a trigger to the table so that when an update occurs I am able capture the session details into a table, however the session details that are being returned are those of the actual trigger rather than those of the original query.

The statement that I am using to capture the session details is...

select * from sys.dm_exec_connections cross apply sys.dm_exec_sql_text(most_recent_sql_handle) where session_id = @@spid

There is a parent_session_id returned in the above which I hoped might give me some pointers but this is always NULL.

I have been working my way through the system dynamic views in the hope that one of them will provide the information I am looking for but so far I've had no luck.

Because the system I am troubleshooting is web based the actual server and user details will be those configured as service accounts for the application but if I am able to show the developers the original query that was used for the update I'm sure they will be able to provide valuable information as to which component it is coming from. I imagine SQL will also be able to tell me which host is sending the query. With these two bits of info I'm sure I'll be able to track it down.

Our suspicion is that an old component is running somewhere and I'd like to be able to track it down. Perhaps I've spent too much time looking at this but I'm coming to the conclusion that it may not be possible from the SQL back end, which I am very surprised at.

I have tried capturing every session that was running at the time of the update but there's simply too much info to deal with. I even searched through these results but there's so many different possible combinations that an update statement might take form that it quickly became a worthless exercise.

Perhaps one of you can resolve this for me. Any ideas?

Regards,

Joe

View 7 Replies View Related

Capture Error In Sp Through Dynamic Query

Dec 10, 2007

I want to capture an error through dynamic query. I have got a link server. I will execute a procedure in database a which will insert data into a table of database b. If while inserting into the table if database b generates an error I have to catch that error in database a and show it.
Please help.

View 1 Replies View Related

Join Query-capture Excluded Data

Sep 26, 2007

I have 2 tables, table one with 772 pieces of compliant data. Table 2 has 435 pieces of data that meet another criteria (all the columns are identical it was just passes through an additional filter). I need to capture the values that are excluded from table 2.

Example Table 1
ID some value
1 x
2 x
3 x
4 x
5 x

Table 2
ID some value
2 x
3 x
5 x

I need to capture the data from ID 1 and 4 and assign a new value to it, it is extra compliant data. Thanks!

View 2 Replies View Related

Analysis :: Profiler Trace Doesn't Capture Full MDX Query

Sep 16, 2015

I am trying to load all the MDX queries that run on a Analysis Server instance into a database for further analysis. A SQL Profiler is setup which captures the MDX queries, and when I am loading the Profiler info to database, some of the queries are not coming up in full length.The TextData field doestn't show full MDX query. When loading to the database, the field is next data type. Is there any workaround to get the complete MDX query? 

View 2 Replies View Related

Capture Changes

May 23, 2002

Is there a way to capture every change made in a database? I would like to be able to audit and report on all changes made in our corp. database. Is there a system tool or function that can accomodate such a thing? Transaction Log maybe??

View 3 Replies View Related

How To Capture Before And After Changes Of DDL

Aug 3, 2015

I have to create DDL trigger for audit to capture the object definition before and after the changes.

Like If any user running the Alter table Statement, i need to capture the Object definition before and after changes..

View 3 Replies View Related

Event Capture

Jul 27, 1998

Hi,
We would like to capture events in our system. There seem to be
three obvious capture points for us - application, triggers, transaction
log. The latter seems to be the most attractive, since we`re looking
for a solution with minimal performance impact. In general, our
problem is similar to populating data warehouses from on-line databases.
Can anyone proffer some advice? In particular, being quite new to
SQL Server, I am not sure how difficult/possible it is to read the
transaction log in order to cull events. Some direction here would
be greatly appreciated.
Thanks,
Karl

View 1 Replies View Related

Capture Error

May 2, 2002

Hi all,
Is there anyway to capture the SQL Server Error and act accordingly?
I donot want sql server to raise an error when a Primary key violation has occured. Instead i want to capture that error(number,description etc) and act
accordingly.
Whats happening is, from the application we are trapping this sql error
and raising it. Instead, if somebody inserts a record which already exists, then we want to trap that error from the sqlprocedure itself and then do an update to that record.

thanks for the help

View 1 Replies View Related

Capture A Sql Command

Aug 16, 2006

Hi All.

I have this project that I need help with. There are 9 tables that I need to capture everything that happens to them (update, insert, delete). I was thinking of creating triggers. If someone does any of these actions against them then I need to insert into another table the date, the table name, the command that was run, and the records that are affected by it. Now I know how to do the date and table name, that's easy. My question is how do I capture the command. Once I have the command I can get the records affected.

If anyone knows how to do this, please help.

Thanks,
ODaniels

View 5 Replies View Related

Text Capture

Jan 30, 2004

I was wondering how you go about capturing text as it is entere into a textarea? i want it captured exactly as it is typed, with carriage returns and everything. is there an easy way to do this?

View 14 Replies View Related

Capture NT User ID

Apr 5, 2007

Access front-end, SQL Server 2005 backend.I have users connected to SQL Server via a Microsoft Access user-interface.Connection is via NT login.I want to log users' activities to the database with their userid.How can I capture their NT User ID (via VBA in Access)?Thanks,Bubbles

View 1 Replies View Related

Capture I/O Per Database

Mar 29, 2007

Hi,



Please help me how can i capture I/O operation per database SQLServer2005.



Regards

Sufian

View 5 Replies View Related

How To Capture Old And New Value In Trigger

Dec 18, 2007



Hi,

in sql server 2005, i was using update trigger with BEFORE but it gives error that
"'BEFORE' is not a recognized trigger."

My requirement is that i want to capture the old value as well as new value of
a column of the updated row in a trigger.

How can i perform this.

thanks in advance

View 3 Replies View Related

CAPTURE DML FROM TRIGGER

Jun 12, 2006

Hi All!

 SQL Server 2000

I've situation where I've to capture a DML executing against let say Table1 and later may at the end of the day or week I want to be able to extract all the DML executed against Table1 and execute them against similar tables on different sql server to synchronize the data. I don't want to use profiler as this is quite expensive resource for my problem niether can use any third party tool.

 

Is it possible to capture sql statement in the trigger?

 

I hope I made my question clear. Urgent help will be highly appreciated.

 

--Sohail.

View 3 Replies View Related

Capture Delta

Oct 13, 2006

how can I capture delta in SQL Server 2005 to refresh base tables in a data warehouse?

View 8 Replies View Related

How To Capture The Correct Identity Value

Sep 15, 2006

I have a stored procedure which will do 2 insert statements on 2 different tables. In my 2nd insert statement, I need to know how to capture the exact identity primary key value of the newly inserted record from the first insert statement. I am not sure how to get the correct key value of the new record because there may be more than one user inserting at the same time. Therefore, it is tough to capture the key value that belongs to the user doing his transaction at the time. Please help out. Thanks in advance.blumonde

View 6 Replies View Related

How Can I Capture The Id Columne From A New Datarow?

May 14, 2007

In my BLL I have a method that adds a new row to a table in the database...
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]    public bool AddContact(string firstname, string lastname, string middleinit, bool active, Guid uid, bool newsletter)    {        ContactsDAL.tblContactsDataTable contacts = new ContactsDAL.tblContactsDataTable();        ContactsDAL.tblContactsRow contact = contacts.NewtblContactsRow();
        contact.FirstName = firstname;        contact.LastName = lastname;        contact.MiddleName = middleinit;        contact.Active = active;        contact.UserID = uid;        contact.Newletter = newsletter;
        contacts.AddtblContactsRow(contact);        int rowsAffected = Adapter.Update(contact);
        return rowsAffected == 1;    }
The primary key in this table is a BigInt set as an identity column....How do I capture the value of the primary key that gets created when the new row is added?

View 3 Replies View Related

How To Capture The Only Time Into The Database

Jun 7, 2006

I've a textbox that displays the current time in this format "hh:mm:ss tt" but when it is save into the database it'll display the date and time together. So how do I save only the time into the database? My codes is as shown below:
 
txtTime.Text = DateTime.Now.ToLongTimeString()
Dim parameterDate As SqlParameter = New SqlParameter("@Date_5",SqlDbType.DateTime)
parameterDate.Value = txtDate.Text
objCommand.Parameters.Add(parameterDate)
 
I've tried using Format() but it still get the same results. Can someone help me out? Thanks!

View 1 Replies View Related

Log Reader And Login Capture

Aug 31, 2001

Is there a way I can view the transaction log mean I want to see the transactions occurred during the last few hours before the commit? And is there a way to capture all the logins who access the DB

View 1 Replies View Related

Capture File To Email

Apr 7, 1999

Does anybody know of a way to set up a task which will send an email with an attachment other than using sp_sendmail. Sp_SendMail will run a query and send the results as a text file. But I need to run a stored procedure which generates an Excel spreadsheet then have an email sent with the Excel file as an attachment. The sp_sendmail text file just doesn't work with the information I am generating so I need to find another solution.

Thanks for any help.

View 1 Replies View Related

How To Capture SQL User Login ?

Sep 22, 1998

I am trying to find a easy way of capturing the SQL user login that is being used for the the record row that is being added/updated. I am now using a insert and update trigger to update the last edit date and record add date. Is there a way I could incorporate the user login capturing within the triggers ???

Thanks for any assistance,

Steve

View 1 Replies View Related

Profiler To Capture Sql For 1 Table

Jan 8, 2008

Using SQL Server 2000

I have to leave a production trace running for a couple of days to track down a little bit of data corruption. I am setting the stop time and maximum file size and I am running it from another machine and writing to a file and not a table and all of that good stuff.

however since I am going to be leaving this running for a while I do not want to deal with a gigantic file to sift through I am trying to limit my trace to all of the stored procs, which can be coming from other databases, to those inserting and and updating a particular table.

I have been goofing around with the Objects:Closed and Objects:Open and the SP:Starting And SP:Completed events, but I can not seem to make this work. I skimmed through the first 5 pages of my google search and my BOL search, but came up empty.

Is this possible? I thought I had done this before.

View 2 Replies View Related

Capture Logout Time

Nov 16, 2011

I need to capture the logout time and login time. I can capture the login time already but I cannot capture the logout time.My logout time and login time need to be on the same entry.This is the coding in the logout button:

Code:
protected void logoutButton_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand("SELECT TOP 1 LogId FROM LoggedInUsers where MemberID = @MemberID ORDER BY LogId DESC");
cmd.Parameters.AddWithValue("@MemberID", Session["MemberID"]);
Session.Abandon();
}

I also need to do in global.asax. And this is the coding:

protected void Session_End(object sender, EventArgs e)
{
if (Session["MemberId"] != null)
{
UpdateLoggedInUsersLogoutTime(Convert.ToInt32(Session["MemberId"].ToString()));
}
//string emailaddress = (string)Session["emailaddress"];

[code]....

View 1 Replies View Related

How To Capture The Error Message?

Apr 26, 2004

Is possible to capture the message of error generated in the execution
of a command SQL?

Thanks.

View 2 Replies View Related

Capture Error Msg Into Another Table

Nov 15, 2013

One of my co-worker told me I can do this to capture errors and insert into error table but when I test it, it doesn't work. Here is what I try to accomplish. SQL 2012. In reality, I have more complicate queries than below.

1. Insert data FROM SourceEmployee INTO Employee table and capture emp_id and error msg insert into dbo.##temperror table
2. Continue on the process until no more record. Basically, skip the error records and do a while loop until end of record.

--DROP TABLE dbo.Employee;
CREATE TABLE [dbo].[Employee]
(
[emp_id] [int] NOT NULL,
[last_name] [varchar](20) NULL,
[first_name] [varchar](15) NOT NULL,

[code]....

View 2 Replies View Related

Capture Header Record

Aug 15, 2007

How t o capture a header record from a flat file and write it to
different table.

It seems that Conditional Split task doesn't work because it detects the different layout and errors out.
any help would be appreciated.
thanks

View 3 Replies View Related

Capture CPU Utilization In TSQL

Jan 2, 2007

Happy New Year everyone!I would like to capture CPU Utilization % using TSQL. I know this canbe done using PerfMon but I would like to run TSQL command (maybe onceevery 5 minutes) and see what is the CPU Utilization at that instant sothat I can insert the value in a table and run reports based on thedata.I have spent a good amount of time scouring google groups but this isall I have found:SELECT(CAST(@@CPU_BUSY AS float)* @@TIMETICKS/ 10000.00/ CAST(DATEDIFF (s, SP2.Login_Time, GETDATE()) AS float)) ASCPUBusyPctFROMmaster..SysProcesses AS SP2WHERESP2.Cmd = 'LAZY WRITER'Problem is this gives me total amount of time CPU in %) has been busysince the server last started. What I want is the % for the instant -the same number we see in Task Manager and PerfMon.Any help would be appreciated.Thanks

View 3 Replies View Related

Capture Existing Table

Jul 20, 2005

I trashed SQL Server2000 when I added the WINXP SP2, and had to reinstallit. When I did, my database(DEV_DATA) remained intact, but when I go inthru Enterprise Manager, it is not located in the system tree, and istherefore inaccessible. Can anyone suggest how I could get this databaseincluded.

View 4 Replies View Related

Table Scheme Capture

Jun 14, 2007

Hi,

I'm wondering if SSIS can capture the table schema structure, including the primary keys, foreign keys and indexes applied from the source table to the destination table? My source tables will be coming from AS400/DB2 and I'm using OLEDB Provider for DB2. I would like to automatically generate the table schema of my destination table in SQL Server 2005 (thru SSIS) as similar as my source table from AS400.



Thanks,

May Lanie

View 3 Replies View Related

How To Capture The Value For A CURSOR Statement

Oct 24, 2007

Hi everyone,

The following snippet of code returns something like that: string;string1;string2

Up to here fine. I woner how to export such value to ssis variable??? That variable will contain the value needed for the FILEATTACHMENTS property (Send Mail Task)

Thanks a lot,


declare @anex as varchar(500)
declare @anex2 as varchar(700)
set @anex2 = ''
DECLARE anexos CURSOR FOR
SELECT [Ruta] + [Fichero] as ANEXO
FROM SVC_FICHEROS INNER JOIN SVC_ENVIOS ON SVC_FICHEROS.IDENVIO = SVC_ENVIOS.IDENVIO
WHERE ENVIADO = 0
OPEN anexos;
FETCH NEXT FROM anexos INTO @anex

WHILE @@FETCH_STATUS = 0
BEGIN
IF @anex2 = ''
begin
set @anex2 = @anex
end
else
begin
set @anex2 = @anex2 + ';' + @anex
end
FETCH NEXT FROM anexos INTO @anex
END
CLOSE anexos
DEALLOCATE anexos

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved