Viewing a SPIDs last SQL statement using sqltext()...though sometimes only partial SQL statements are shown - why ?

The dbcc sqltext() command seems to allow you to view the last SQL statement
issued by an active SPID on the server. However I've noticed that sometimes
only part of the SQL statement is returned - does anyone know why this might
be, and if so whether it's due to a server configuration.


Anyway, here's my notes on how to view the last SQL statement processed:


** How to see the last SQL a SPID has processed

-- dbcc traceon(3604) Directs trace output to the client, rather than to the
error log

1> dbcc traceon(3604)
2> go
DBCC execution completed. If DBCC printed error messages, contact a user
with System Administrator (SA) role.


-- Viewing the last SQL statement executed by SPID #349

1> dbcc sqltext(349)
2> go
SQL Text: select 250292, 99.900000, 0.000000, 0.000000, "",
convert(datetime, "30APR2003 00:00:00")
DBCC execution completed. If DBCC printed error messages, contact a user
with System Administrator (SA) role.


-- dbcc traceoff(3604) Restores trace outputing to the error log

1> dbcc traceoff(3604)
2> go


Without the dbcc traceon/off, information goes the the stdout log file
captured from the startserver command.
eg.  startserver -f ASE > /var/log/sqlog.ase



0
svaardt
5/27/2003 6:28:10 AM
sybase.ase.general 8655 articles. 0 followers. Follow

1 Replies
985 Views

Similar Articles

[PageSpeed] 30

The maximum length of the SQL text that can be printed is 500 bytes. This is
due to a maximum print string limit of 512. You subtract 2 bytes for
formatting characters, and 10 bytes for "SQL Text: ".  This is not
configurable.
By the way, the statement you included is a valid statement and does return
results, so it is possible that that is the entire statement:
1> select 250292,99.900000,0.000000,0.000000,"",convert(datetime,"30APR2003
00:00:00")
2> go
 ----------- ----------- ---------- ---------- - --------------------------
      250292   99.900000   0.000000   0.000000          Apr 30 2003 12:00AM

(1 row affected)

Regards,
Mark

TechWave 2003: Stop by the Tech Services Booth and say hello.
http://www.sybase.com/sb_content/1023729/index.html

"svaardt" <svaardt@h0tmail. com> wrote in message
news:e6zZ$jBJDHA.311@forums-1-dub...
The dbcc sqltext() command seems to allow you to view the last SQL statement
issued by an active SPID on the server. However I've noticed that sometimes
only part of the SQL statement is returned - does anyone know why this might
be, and if so whether it's due to a server configuration.


Anyway, here's my notes on how to view the last SQL statement processed:


** How to see the last SQL a SPID has processed

-- dbcc traceon(3604) Directs trace output to the client, rather than to the
error log

1> dbcc traceon(3604)
2> go
DBCC execution completed. If DBCC printed error messages, contact a user
with System Administrator (SA) role.


-- Viewing the last SQL statement executed by SPID #349

1> dbcc sqltext(349)
2> go
SQL Text: select 250292, 99.900000, 0.000000, 0.000000, "",
convert(datetime, "30APR2003 00:00:00")
DBCC execution completed. If DBCC printed error messages, contact a user
with System Administrator (SA) role.


-- dbcc traceoff(3604) Restores trace outputing to the error log

1> dbcc traceoff(3604)
2> go


Without the dbcc traceon/off, information goes the the stdout log file
captured from the startserver command.
eg.  startserver -f ASE > /var/log/sqlog.ase





0
Mark
5/27/2003 2:56:20 PM
Reply:

Similar Artilces:

SQL statement and If statement
I've problem, it's in sqlcommand it's in "where" condition, which if it's exist in sql the "ELSE" not work, and if the condition not in sqlcommand the "ELSE" appear, could someone help  it's in selectcommand.CommandText = "SELECT Weekno FROM Weeks where Weekno='" + Weekno.Text + "'" if i delete the condition the " ELSE " appear. otherwise it's not appear whole code Dim myconnection As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\football.mdf;Integrated S...

Executing the i-sql statements using i-sql interface.
I am writing the c/c++ interface which will execute i-sql query statements to retrive information from the isql. It involves parsing the isql output to get the required information objects ( database, devices, ...etc). This parsing string method seems to be not appropriate, as the format of the isql statement might change in future release of ASEs. I am wondering is there any otherway I can access the information(like querying info of databases, devices, ...etc) from sybase server from "C/C++" program in structural manner??. Is it possible to get the return status(succe...

Viewing last SQL statement
Is there any way, in enterprise manager or otherwise, for me to view the last few SQL statements executed against my sql server?ThanksPlease mark posts as the answer if I was helpful. Thanks!Visit my blog SQL Profiler will allow you to view what's going on in SQL Server including queries being executed.RyanRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question...

SQL Logging SQL Statement
Hi at All!! I use ASA 7 so I'd like to know if there is a way to logging the sql instruction that database server dbsrv7, receive from clients ? I need this because a client that use odbc connection after performing an insert into a table, the client receive the Message: "SQL truncate". I need to know the field on the table that generate this warning!! Thanks in advance Massimo The tool that does this is called "request-level logging" and in V7 you have to enable it from the command line when you start the server, using the -zr (and optionally -zo) c...

Adding an IF Statement to the SQL Statement
I have the following tables and SQL statment which works out a league table for me from the given results. I am now trying to add a bit more to this: If the Walkover column = 1 then that row will be a home walkover meaning that the score will be 0(Home Score) - 0(Away Score) but the home team will recieve 3 points, and away team recieves 0 points, win column will be 1 and the played colum will be 1 as well.If the Walkover column = 2 then that row will be a home walkover meaning that the score will be 0(Home Score) - 0(Away Score) but the away team will recieve 3 po...

If Statement combined with SQL statement.
Hi  This is going to sound like quite  a strange question. Basically what I am trying to do is use Membership.GetUser().UserName to get the current user who is logged in and I want to see if that user exists in a table on my database before adding some data to the labels. I figured it should go in the page load part. The name of the table is userteams. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) If Membership.GetUser().UserName exists in Userteams Then goallie.Text = Select player FROM Userteams Where Username = Membership.getUser().Use...

Why these two SQL statement return differently? using ROUND() function in Transact-SQL
Hello, DECLARE @x DECIMAL SET @x = 65.554 SELECT ROUND(@x, 1) --this returns 66 SELECT ROUND(65.554, 1) --this returns 65.600 can someone explain to me why is like that?  Thank you   Always specify the size for the parameters. For example: Decimal(10,3). ***********************Dinakar NethiLife is short. Enjoy it.*********************** DECLARE @x DECIMAL(10,3) SET @x = 65.554 SELECT ROUND(@x,1) SELECT ROUND(65.554,1) both return the same answer. ndinakar & Motley Thank you two very much.  I got it.  :)...

view data in crystal report using SQL statement
how i display data in crystal report using SQL statement Hi,Option 1...In this case you can use Crystal SQL Designer and then design report based on this query file.When using Crystal SQL Designer you can write your query which would generate a file with extension .qry.Now you can open Crystal Report designer and design report which will be based on this query file. Crystal SQL Designer tool is shipped with your Crystal Reports.Option 2...Using the option 2, you can design your report by using any method like ODBC, OLE DB etc. and then while coding what you have to do is fetch th...

combining 2 sql statements using Access version and not sql server to show results in a data list
Hi, I have 2 sql statements which will run in Access: private string m_cmdInitial = "Select Distinct Mid([Attribute Name],1,1) AS Initial FROM [Attributes]";  private string m_cmdCustmrs = "SELECT * FROM [Attributes] WHERE(Attributes.[Attribute Name]) LIKE '{0}*'"; The thing is that using SQL server the two sql statements can be combined using the format Function of ASP.net just by putting semicolon between the statements. The purpose is as follows: I am using 2 data lists. The first one is just a list of letters on top from which the user can choose a letter on which the term starts...

Please Help me:SQL statement failed: (-301) Internal database error ??? -- transaction rolled back SQL statement failed: (-101) Not connected to a database
Hi all, I am using Adaptive Server Anywhere 8 version 8.0.2.4239. I am able to sync successfully between 2 desktops with the same version. When I am trying to sync with my pocket pc device version 8.0.4122, Towards the end of Synchronization (nearly 95% completed) ,I am getting this error "E. 05/29 19:28:31. SQL statement failed: (-301) Internal database error ??? -- transaction rolled back E. 05/29 19:28:31. SQL statement failed: (-101) Not connected to a database" The log file contains E. 05/29 19:28:31. SQL statement failed: (-301) Internal database er...

View SQL Statements
SQLA 5.5.0.5 #2764 Isn`t there a switch somewhere in DBSRV50 that allows me to see the SQL statements being executed in the Message window?? I`m sure I`ve seen this before, but I can`t find the info to enable it.... Thanks Not sure this is in version 5, but in subsequent versions (at least) it's: call sa_server_option('request_level_logging','on'); "Ray Norrish" <ray@careervision.co.uk> wrote in message news:xMprqL7uBHA.304@forums.sybase.com... > SQLA 5.5.0.5 #2764 > > Isn`t there a switch somewhere in DBSRV50 that allo...

General SQL statement?
Once I have a table in SQLAnywhere 5.5.04, is there any way to generate a SQL statement that would have created it? Someone else needs to recreate the structure of my table and I'd like to send them a SQL statement that they could use to do so. One way to do it is to (for example, you need foo_table TABLE): 1) unload database (can be done from Sybase Central) into foo.sql 2) copy "CREATE TABLE foo_table" command where you need it... Petar Rick Charnes wrote: > > Once I have a table in SQLAnywhere 5.5.04, is there any way to generate > a SQL stateme...

view SQL statement?
When I do a PB update() from a datawindow, I sometimes want to see the SQL statement I'm sending out to the database. I know I can insert a MessageBox() statement in the dw's sqlpreview event and display its 'sqlsyntax' value. Is there a way I can have this displayed while I'm in the script of the command button from which I'm actually doing the dw.update()? Thanks. You could have the DataWindow cache the statements in something like instance variables or a file, and then access them from the command button script. What's the disadvantage of look...

How to write SQL to form &quot;New Table&quot; from Job Revence and Job Cost using SQL statement ? thx
Edited by SomeNewKid. Please post code between <code> and </code> tags. // Pls copy the following HTML after that you generate the HTML page. Then you will know what I mean. I need to form "New Table" from Job Revence and Job Cost using SQL statement? thx -----------The following code----------------- <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=big5"> <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/...

Web resources about - Viewing a SPIDs last SQL statement using sqltext()...though sometimes only partial SQL statements are shown - why ? - sybase.ase.general

User:Jimbo Wales/Statement of principles - Wikipedia, the free encyclopedia
As we move forward with software and social changes, I think it is imperative that I state clearly and forcefully my views on openness and the ...

Category:Articles containing potentially dated statements from June 2006 - Wikipedia, the free encyclopedia ...
This is an administration category . It is used for administration of the Wikipedia project and is not part of the encyclopedia. It contains ...

Paris attacks: Grand Mufti of Australia Dr Ibrahim Abu Mohammed issues clarifying statement condemning ...
The Grand Mufti&nbsp;of Australia says he has always &quot;consistently and&nbsp;unequivocally condemned all forms of terrorist violence&quot;. ...

"No justification for the taking of innocent lives": Mufti clarifies statement
The Grand Mufti of Australia has hit back at criticisms that his comments following the deadly Paris attacks justified terrorism, saying he &quot;unequivocally ...

Presidential Statement and Press Conference
Came back from walking the dog to find that the adult was in the room and speaking clearly about events. The link to the live feed is here. ...

"Welcome to our home. Please take a moment to review our latest statement regarding so-called micro-aggressions..." ...
"... together with a revised list of 'trigger warning' requests. Kindly commit the following to memory...." Trigger warning for Althouse readers: ...

Liveblogging World War II: Robert H. Jackson: Opening Statement before the International Military Tribunal ...
**Robert H. Jackson**: [Opening Statement before the International Military Tribunal](https://www.roberthjackson.org/speech-and-writing/open ...

Eagles of Death Metal issue statement on Paris terror attack
Previously: Josh Homme's Sweet Stuff Foundation raising money for families of Paris attack victims Nick Alexander was Eagles of Death Metal's ...

ISIS is 'trying to taunt' Anonymous with a new statement on the hackers' declaration of 'war'
A propaganda account affiliated with ISIS has released another statement related to the hacking collective Anonymous' declaration of "war" on ...

Lynch: Obama’s Statements Have ‘No Influence’ On Clinton Investigation
Does the DOJ 'allow statements by the president to dictate its investigative practices?'

Resources last updated: 11/23/2015 4:06:46 PM