Saturday, August 13, 2011

Using SQL to generate cygwin curl command line to render all SSRS reports to a file on disk


use [ReportServer]
go

-- http://server/ReportServer?REPORT_PATH&rs:Command=Render&rs:Format=PDF&myparam1=Value1&myparam2=Value2
-- http://server/ReportServer?REPORT_PATH&rs:Command=Render&rs:Format=CSV&rc:FieldDelimiter=%09

SELECT
	'curl --ntlm -u "ntlmDomain\ntlmUserName:Password" "'
	+ replace(replace('http://server/ReportServer?REPORT_PATH&rs:Command=Render&rs:Format=CSV&rc:FieldDelimiter=%09', 'REPORT_PATH', c.Path),' ', '%20')
	+ '" > "' + replace(c.Path, '/', '_') + '.txt"'
FROM 
	[dbo].[Catalog] c
WHERE 
	Type = 2
	--and Path like '/BetaSite/%'

1 comment:

Carlos Klapp said...

Use this command to search for errors: findstr "/C:\=\"500\"" *.txt