How to create an Excel file using SQL 2005

  • Please help me to create dynamic XLS file and insert data in different sheet.

  • Use the following example.

    select (@maxno/50000) + 1 SheetsCount

    while @maxno >= 0

    begin

    select @TempSno = isnull(@TempSno,0) + 1

    select * from yourtable where Slno between (50000 * (isnull(@TempSno,0)-1))+1 and 50000 * @TempSno order by Slno

    select @maxno =@maxno - 50000

  • Thanks for your reply....but I want script to generate Excel file.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply