Showing posts with label stmt. Show all posts
Showing posts with label stmt. Show all posts

Wednesday, March 21, 2012

Last SQL Statement run on SQL Server

Hi All,

Im just wondering if there is any way to get the last SQL Stmt or SP that was run on the server without using the SQL Profiler or third party software.

Thanks and have a nice day to all.No. There is really no easy way to determine this information. And do you want last SQL statement or SP executed by any connection? Or is it the last on the server? In some cases, you could use DBCC INPUTBUFFER with the currently executing or inactive SPIDs but this is not entirely accurate. And if the connections have disconnected from the server then there is really no record. You could look at the cached plan entries but there is no way to relate them in order of time and you will miss statements that were not cached for example. What are you trying to do with this information though? What do you want to determine from knowing the last command that was sent to the server?|||

Thanks for the reply.

Just only wondering if there is any alternate way using sql stmt on SQL Query Analyzer by not using the SQL profiler to get the SQL stmts.

Monday, February 20, 2012

Large delete stmt - 2nd question

Publisher has delete stmt executed against transactionally replicated table.
270K rows deleted in 1 stmt.
1 Subscriber connected with T1
How best to replicate all the 270K simpleton delete calls to
sp_MSdel_tablename at subscriber through distr agent? What parameter
adjustments to make?
Changed -CommitBatchSize to 1000, doesn't seem to increase speed much...
Thanks,
Chris
Set HistoryVerboseLevel to 0, CommitBatchSize to 1000 and
CommitBatchThreshold 10000
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Chris" <Chris@.discussions.microsoft.com> wrote in message
news:DED73E09-DA75-444C-8976-96FF475B9567@.microsoft.com...
> Publisher has delete stmt executed against transactionally replicated
table.
> 270K rows deleted in 1 stmt.
> 1 Subscriber connected with T1
> How best to replicate all the 270K simpleton delete calls to
> sp_MSdel_tablename at subscriber through distr agent? What parameter
> adjustments to make?
> Changed -CommitBatchSize to 1000, doesn't seem to increase speed much...
> Thanks,
> Chris