Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


insert printed messages from message tab into a table!!!!


insert printed messages from message tab into a table!!!!

Author
Message
nogardoel
nogardoel
SSC-Enthusiastic
SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)

Group: General Forum Members
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
MarkusB
MarkusB
SSCarpal Tunnel
SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)SSCarpal Tunnel (4.5K reputation)

Group: General Forum Members
Points: 4457 Visits: 4208
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
nogardoel
nogardoel
SSC-Enthusiastic
SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)SSC-Enthusiastic (149 reputation)

Group: General Forum Members
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
Rowshambo
Rowshambo
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 Visits: 65
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

Smile

G
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search