Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

usp_SQL_In_sp_who2 Expand / Collapse
Author
Message
Posted Friday, March 27, 2009 9:19 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, November 10, 2014 5:24 PM
Points: 68, Visits: 377
Comments posted to this topic are about the item usp_SQL_In_sp_who2
Post #685491
Posted Friday, April 24, 2009 7:04 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, November 25, 2014 7:53 AM
Points: 4, Visits: 98
Very cool. But it would be nice to get rig of the cursor and replace with Min/Max looping logic. Otherwise this is an excellent utility.
Post #703913
Posted Friday, April 24, 2009 8:46 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, November 13, 2014 11:19 AM
Points: 1,082, Visits: 551
Nice surf. 3 of us took a 2 hour brunch on Tuesday...
Post #704023
Posted Friday, April 24, 2009 3:07 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, November 14, 2014 9:55 AM
Points: 436, Visits: 2,311
You don't indicate what version you're running, but if SQL2005 you could (quick n dirty) do this.. it returns a superset of the columns you used but you can always customize that.

SELECT
sp.*,
DB_NAME(sp.dbid) dbname,
OBJECT_NAME(st.objectid,sp.dbid) as oname,
CAST(st.text AS VARCHAR(7000)) as script
FROM
sys.sysprocesses sp
CROSS APPLY
sys.dm_exec_sql_text (sp.sql_handle) st

...BOL mentions sys.sysprocesses is not long for this world so you *really* should use one of these-- depending on what you need:

sys.dm_exec_connections
sys.dm_exec_sessions
sys.dm_exec_requests




Cursors are useful if you don't know SQL
Post #704323
Posted Friday, April 24, 2009 3:27 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, May 31, 2013 7:10 AM
Points: 5, Visits: 105
Nice Wave Man! memories of Kirra Point.
Post #704326
Posted Monday, June 14, 2010 8:20 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, June 4, 2012 8:18 AM
Points: 155, Visits: 123
I have problems with getting it to run. I am getting errors on the single quotes (Unicode probably). Is there an easy way to fix it?
Post #936868
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse