Showing posts with label requirement. Show all posts
Showing posts with label requirement. Show all posts

Monday, March 19, 2012

joining sysprocesses with fn_get_sql

ok, I have a requirement where I need to get a list of sql commands currently being blocked.
This is very easy to do via stored procedure, and I have it working well using a vb.net console app to fire it off.

Trouble is, I need to ship it to different offices on an ad hoc basis. I don't want to install a stored procedure on each site because it'll be a one off job and there is not likely to be anyone available who would know how to even install a new sp. So, I thought I'd try and pull back the sql commands via a select statement, joining together sysprocesses and the fn_get_sql udf. This returns a table, so I presumed I could join the two together using a subquery via the sql_handle with something like this :

SELECT sql_handle,
(
SELECT top 1 [text] FROM ::fn_get_sql(sysprocesses.sql_handle)
) as sqlcommand

FROM master..sysprocesses

The error back is incorrect syntax near 'sysprocesses'. I can't see if I'm doing anything obvious wrong.

Anyone any ideas? I'm using SQL Server 2000 sp3.A BOL example for using fn_get_sql:
DECLARE @.Handle binary(20)SELECT @.Handle = sql_handle FROM sysprocesses WHERE spid = 52SELECT * FROM ::fn_get_sql(@.Handle) HTH|||thanks for your reply, however, that will only work in a stored procedure.
I won't be able to install a sp, as it needs to be completely standalone.
I'm trying to find a one-hit SQL query to do the job. It should work, but it doesn't.

cheers,

Joining of datasets supported in future version?

There are a number of posts in this group that have asked if datasets
can be joined which suggests that there is some requirement for this
functionality. We are currently comparing RS to Brio which allows
this.
Does anyone know if this feature will be introduced in a future
version?
Thanks,
PaulYou can join datasets using the OpenRowset feature of SQL Server.
--
Rajeev Karunakaran [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Paul Taylor" <pjtaylor@.email.com> wrote in message
news:3e0bce4c.0407260213.79edf12e@.posting.google.com...
> There are a number of posts in this group that have asked if datasets
> can be joined which suggests that there is some requirement for this
> functionality. We are currently comparing RS to Brio which allows
> this.
> Does anyone know if this feature will be introduced in a future
> version?
> Thanks,
> Paul|||It's a high-priority item on our wishlist for a future version, but we don't
have any specific plans for it right now (the high cost of implementation
makes it unlikely this will make it into SQL 2005).
--
This post is provided 'AS IS' with no warranties, and confers no rights. All
rights reserved. Some assembly required. Batteries not included. Your
mileage may vary. Objects in mirror may be closer than they appear. No user
serviceable parts inside. Opening cover voids warranty. Keep out of reach of
children under 3.
"Paul Taylor" <pjtaylor@.email.com> wrote in message
news:3e0bce4c.0407260213.79edf12e@.posting.google.com...
> There are a number of posts in this group that have asked if datasets
> can be joined which suggests that there is some requirement for this
> functionality. We are currently comparing RS to Brio which allows
> this.
> Does anyone know if this feature will be introduced in a future
> version?
> Thanks,
> Paul