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 |
|
andryi
Starting Member
17 Posts |
Posted - 2010-03-15 : 23:51:42
|
| Hi all, I've got a question, how can i to export data for example : select * from user to an excel file with your sheet, for example, Book1, SheetUsers.I read this topic http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926but I got a problem If I use the option 1, I can create a file , ok, but If I got 10 registries, and I run once the procedure I got in the excel 10 registries, but If I run 5 times, I've 50 registries when I only want 10 registries, the option 4 (for now, for me , is the best) I run 5 times and I've got 10 registries so is Ok, but I want to export an only one excel file so If I got 2 querys , for example select * from user ---> to SheetUser (sheetname)select * from city ---> to SheetCity (sheetname)I don't know how can I indicate the name of sheet.and the option 5 , is good, but the same I don't know how can I indicate the name of the sheet, can anybody help me please |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-16 : 00:48:46
|
| isntead of SheetName$ in example use your actual sheet name------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
andryi
Starting Member
17 Posts |
Posted - 2010-03-16 : 01:04:22
|
| ok, I run query1 and is saved in the sheet1, and after I run query2 to the same excel file, is saved to sheet2 but sheet1 not exists, so I think is because delete all the information and then create the new information |
 |
|
|
andryi
Starting Member
17 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-03-17 : 02:56:10
|
quote: Originally posted by andryi ok, I run query1 and is saved in the sheet1, and after I run query2 to the same excel file, is saved to sheet2 but sheet1 not exists, so I think is because delete all the information and then create the new information
That willnot happen when you correctly specify the sheetnamesCan you post the code you used?MadhivananFailing to plan is Planning to fail |
 |
|
|
andryi
Starting Member
17 Posts |
Posted - 2010-03-17 : 15:31:08
|
| Hi madhivanan, well this is the query that I use:EXEC sp_makewebtask @outputfile='C:\REPORTS\SCOP\User.xls', @query='SELECT * FROM User', @colheaders =1, --@FixedFont=0, @lastupdated=0, @resultstitle='List of User'I don't know how to put the sheetname, and the other options for example option1 : it's necesary hace the file ande the name of columns, but if I run once ÇI've got 10 registries and I run again I've got 20, one more, 30 ... so that's the reason why I don't user the option1 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-03-18 : 03:22:09
|
| Did you try using other points?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|