October 11, 2007 at 7:42 am
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
October 11, 2007 at 8:13 am
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
[font="Verdana"]Markus Bohse[/font]
October 11, 2007 at 10:59 pm
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
January 6, 2010 at 7:50 am
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
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply