Well, I got a new experience in teaching that I am feeling to share with other people. Today I have taken class of some people who are aged like my father to grandfather. Whenever, I found my grandfather-like people calling me sir, it was really uncomfortable for me to accept that. However, this is a rule that must be followed and according to that some rule I had to continue the class and I did that. To be honest, I enjoyed my stay at that class solving technical problems and assisting in presentation. And I found those people are really eager to learn about technology and presentation skills and matter is they are much aged in service life... but I was delighted to teach their technical things and good news is that they want more class for me...but that is not possible.
thanks.
Masud (7-2-2010)
Sunday, February 7, 2010
Saturday, February 6, 2010
Exporting data from sql server table to excel file
Exporting data from sql server table to excel file requires two levels to query execution. They are given below.
1. Enabling OPENROWSET (executed by DBA)
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=E:\testing.xls;',
'SELECT BusCatID,Description FROM [Sheet1$]')
SELECT BusCatID,Description FROM hooser_burger_db.dbo.BusinessCategory
Before executing the query developer has to create an .xls file and he/she has to denote the header or column name of sql sever tables to be exported in the excel file. Then after running the query he can consume the data from the file.
Masud (7-2-2010)
1. Enabling OPENROWSET (executed by DBA)
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO
2. This is second part by which actually data will be exported from sql table to excel file. Here is the query worked for me.INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=E:\testing.xls;',
'SELECT BusCatID,Description FROM [Sheet1$]')
SELECT BusCatID,Description FROM hooser_burger_db.dbo.BusinessCategory
Before executing the query developer has to create an .xls file and he/she has to denote the header or column name of sql sever tables to be exported in the excel file. Then after running the query he can consume the data from the file.
Masud (7-2-2010)
Subscribe to:
Posts (Atom)