SQL Server Performance

How to generate report in Text format (NOT CSV)

Discussion in 'SQL Server 2005 Reporting Services' started by rupeshpatel, Jun 5, 2009.

  1. rupeshpatel New Member

    Does anybody know? how to create a report in text format or any other custom format from Reporting Services?????I couldn't find any way doing this!!!!Please respond.thanks,-RP
  2. freezea New Member

    Hi, RP.

    I have an idea to solve your problem.
    You can first make report with RAQ Report, and then export the report to text format, or any else format you need. RAQ Report can export report to Word, PDF, Excel, Html,XML format.
    You can get the free reporting tool at http://www.raqsoft.com/.

    I wish this can help. Good luck.
  3. rupeshpatel New Member

    Nope, It will not help, not going to use any custom tool as long as possible. If I won't be able to generate using SSRS then, other developer is ready to go with V.Foxpro. So this option will not help me. thanks for your reply any way...-RP
  4. jkz999 New Member

    Not easy, but not impossible.
    Declare @file INT, @fs INT, @ole INT, @pdf VARCHAR(100), @trenutniRed NVARCHAR(200),

    SELECT @pdf = 'C:' + @filename + '.pdf'

    EXECUTE @ole = sp_OACreate 'Scripting.FileSystemObject', @fs OUT

    EXECUTE @ole = sp_OAMethod @fs, 'OpenTextFile', @file OUT, @pdf, 8, 1

    FOR SELECT code FROM #temp ORDER BY idnumber -- the rows you want to write out to the text file
    OPEN SysKursor
    FETCH NEXT FROM SysKursor INTO @trenutniRed
    WHILE @@Fetch_Status = 0
    EXECUTE @ole = sp_OAMethod @file, 'WriteLine', Null, @trenutniRed
    FETCH NEXT FROM SysKursor INTO @trenutniRed
    CLOSE SysKursor
    DEALLOCATE SysKursor
    EXECUTE @ole = sp_OADestroy @file
    EXECUTE @ole = sp_OADestroy @fs

    Please note, the above code contains all bad practices I can thinkl of! [:O]

Share This Page