September 17, 2010 at 3:33 pm
SKYBVI (9/17/2010)
@ ericYa, true , you have to give them a login and permission too.
About the refresh page, there is a option in connection properties,
refresh after __ minutes and also
refresh data while opening the file.
I guess they should make easier the work of the user.
Regards,
Sushant
Clicking the Refresh button is easy enough for the Excel user, but my point was that it's perhaps too easy. The user could bring the server to it's knees, if it's long running query, and they keep clicking on Refresh, and even more so if they configure the data to auto-refresh every few minutes. You have to be careful about what SQL is behind that Excel sheet.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho
September 17, 2010 at 6:12 pm
From a SQL 2000 Server.
The following assumes you are using EXCEL 2003 or earlier. If you are using EXCEL 2007 or later then the command must be altered to use the proper EXCEL driver.
1. The Excel data sheet must exist.
2. The column headings in the sheet must be the names of the columns being exported.
3. Excel must be installed on the server which contains SQL Server and the database.
The use open Rowset to perform the export:
In this example I was using the Northwind DB.
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Temp\TestK.xls', 'SELECT * FROM [Sheet1$]')
SELECT CustomerId,CompanyName,ContactName FROM dbo.Customers
In the above code
C:\Temp\TestK.xls' -- Is the path to the existing Excel Spread sheet
with the colum headings
CustomerId,CompanyName,ContactName - Columns from which the data is selected and returned.
This is a small sample of the data written to the specified Excel file
CustomerId CompanyName ContactName
ALFKIAlfreds Futterkiste Maria Anders
ANATRAna Trujillo Emparedados y helados Ana Trujillo
ANTONAntonio Moreno Taquería Antonio Moreno
AROUTAround the Horn Thomas Hardy
BERGSBerglunds snabbköp Christina Berglund
BLAUSBlauer See Delikatessen Hanna Moos
BLONPBlondesddsl père et fils Frédérique Citeaux
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply