create our pubs spreadsheet
--Now we can create our pubs spreadsheet, and can do it from any of --our servers -- spDMOExportToExcel @SourceServer='MyServer', @SourceUID= 'MyUserID', @SourcePWD = 'MyPassword', @QueryText = 'use MyDatabase select Pubname, Address, Postcode from ##CambridgePubs', @filename = 'C:\MyPubDatabase.xls', @WorksheetName='MyFavouritePubs', @RangeName ='MyRangeName'
--or if you are using integrated security! spDMOExportToExcel @SourceServer='MyServer', @QueryText = 'use MyDatabase select Pubname, Address, Postcode from ##CambridgePubs', @filename = 'C:\MyPubDatabase.xls', @WorksheetName='MyFavouritePubs', @RangeName ='MyRangeName'
/* Although this is a very handy stored procedure, you'll probably need to modify and add to it for particular purposes.
We use the DMO method because we like to dump build data into Excel spreadsheets e.g. users, logins, Job Histories. However, an ADODB version is very simple to do and can be made much faster for reads and writes.
We have just inserted values, but you can insert formulae and formatting numberformat) and create or change borders. You can, in fact, manipulate the spreadsheet in any way you like. When we do this, we record macros in Excel and then convert these macros to TSQL! Using the above example, it should be simple */
|
手机版|小黑屋|BC Morning Website ( Best Deal Inc. 001 )
GMT-8, 2026-4-11 11:37 , Processed in 0.043133 second(s), 22 queries .
Supported by Weloment Group X3.5
© 2008-2026 Best Deal Online