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

insert printed messages from message tab into a table!!!! Expand / Collapse
Author
Message
Posted Thursday, October 11, 2007 7:42 AM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Thursday, July 24, 2014 9:11 AM
Points: 149, Visits: 113
I have an custom extended stored procedure which when executed prints some information on the messages tab of sql server, this is some valuable information and not error message. I am trying to insert these messages into a table. The extended stored procedure is of a third party tool which is created in sql server when this third party tool creates its own repository!. This stored procedure tells us information about the number,size and names of log and data files in the database backup it creates.

I have been struggling to insert these messages into a table ..... it would be of great help if someone could help m e out in this!!! .... thanks in advance
Post #409524
Posted Thursday, October 11, 2007 8:13 AM
SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Yesterday @ 7:14 AM
Points: 4,432, Visits: 4,168
Withoput having your extended procedure it's almost impossible to tell what you can do and how. But if you're just interested in information about backups like files, size, date etc. you can find all this in msdb.dbo.backupset.
Markus


Markus Bohse
Post #409547
Posted Thursday, October 11, 2007 10:59 PM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Thursday, July 24, 2014 9:11 AM
Points: 149, Visits: 113
I execute the below statement in management Studio:

EXEC [master].[dbo].[xp_ss_list] @filename = @ArchivePathAndFilename,@debug = 0


and here is the message in prints:

xp_ss_list completed successfully.

dummyFullPRIMARYdummyC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\dummy.mdf
dummyFullPRIMARYdummy1C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\dummy1.ndf
dummyFullNULLdummy_logC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\dummy_log.ldf
dummyFullNULLdummy1_logC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\dummy1_log.ldf


(0 row(s) affected)

----------------------
what exactly its doing is ..... i create a backup file using this tool(idera), and i am trying to list the contents of the backup file using the same tools's custom extended procedures.

My question now would be how to capture these messages printed into a table
Post #409831
Posted Wednesday, January 6, 2010 7:50 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, May 23, 2014 6:21 AM
Points: 33, Visits: 58
Man, I had this exact same problem (with SQLSafe's xp_ss_list). I needed to capture the logical and filenames from the backups and darnit, it just wasn't capturing them any way, any how!

As it turns out, I may actually have a solution! Ok, it ain't elegant by a long shot, and it's not totally complete yet, you will need to perform a few more substring tricks to extract the values. But hey, I LITERALLY just figured it out, and I'm overly excited to actually be able to contribute back to this site for a change. So here it is:

create table #temp (result varchar(2000))
go

declare @cmdshell varchar(1500)

declare @string varchar(100)

set @string = '''\\SomeServer\SomeSQLSafeBackup.SAFE.BAK'''

set @cmdshell = 'osql -S SomeServer -E -Q "master..xp_ss_list @filename = ' + @string + '"'

insert into #temp

EXEC master.dbo.xp_cmdshell @cmdshell

select * from #temp

How cool is that? Print it out in SQLCMD / osql, jam that into a temp table and presto... you have the results.

I hope this helps out, maybe you have another situation where an extended proc or message to screen won't capture.

You are welcome

:)

G
Post #842812
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse