Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
avijit_mca
Posting Yak Master
109 Posts |
Posted - 2010-07-16 : 00:53:01
|
Execute SQL Script :declare @tab varchar(40),@no int,@SQL varchar(max)set @no= (select COUNT(name) from sys.tables where name not IN ('UserInfo'))set ANSI_WARNINGS offwhile @no >=1 beginselect @tab=name from (select row_number() over (order by name) as Row,name from sys.tables where name not IN ('UserInfo')) as t where t.row=@no--begin try--begin tran select @tabexec(' insert into ['+@tab+']select * from WSS_Content_2010..['+@tab+'] D where d.tp_DeleteTransactionId =0x andnot exists(select * from ['+@tab+'] p where p.id = d.id )') --commit end trybegin catch select 'Execution Not success For Table:' ,@tab, ERROR_MESSAGE() , ERROR_NUMBER ()end catchset @no=@no-1endThen i link with script.I want to display all Resulset in catch block.if i run this query in SSMS it showing error message. but if i pass variable in script it showing only true flag.any idea how i will show all the error message using script or write all the message in a file. any thing it would be fine for me.Regards,avijit |
|
|
|
|