Click here to Skip to main content
15,902,635 members
Home / Discussions / Database
   

Database

 
GeneralRe: An error encountered when ms sql server 2005 have to send a lots of data Pin
dasha_pl22-Jul-08 1:52
dasha_pl22-Jul-08 1:52 
GeneralRe: An error encountered when ms sql server 2005 have to send a lots of data Pin
Wendelius22-Jul-08 5:33
mentorWendelius22-Jul-08 5:33 
GeneralRe: An error encountered when ms sql server 2005 have to send a lots of data Pin
dasha_pl22-Jul-08 21:44
dasha_pl22-Jul-08 21:44 
GeneralRe: An error encountered when ms sql server 2005 have to send a lots of data Pin
Wendelius23-Jul-08 5:48
mentorWendelius23-Jul-08 5:48 
QuestionExcel Query [modified] Pin
Sunil Wise17-Jul-08 21:01
professionalSunil Wise17-Jul-08 21:01 
AnswerRe: Excel Query [modified] Pin
Sunil Wise17-Jul-08 21:32
professionalSunil Wise17-Jul-08 21:32 
QuestionHow to insert data from MS SQL server in MS EXCEL Sheet? Pin
guriqbal8717-Jul-08 4:22
guriqbal8717-Jul-08 4:22 
AnswerRe: How to insert data from MS SQL server in MS EXCEL Sheet? Pin
leoinfo17-Jul-08 5:17
leoinfo17-Jul-08 5:17 
This example is using SQL 2005.

Create a new Excel file: c:\testXL.xls
Open the file and write ID into the cell A1, FirstName into the cell B1.
Sace and close the file.

The code below will add 3 rows to the Excel file.
CREATE TABLE #T (ID INT IDENTITY(1,1), FirstName nvarchar(20))
INSERT INTO #T (FirstName) SELECT 'John'
INSERT INTO #T (FirstName) SELECT 'Kyle'
INSERT INTO #T (FirstName) SELECT 'Stacey'

INSERT INTO 
	OPENROWSET (
		  'Microsoft.Jet.OLEDB.4.0'
		, 'Excel 8.0;Database=c:\testXL.xls;HDR=YES;'
		, 'SELECT ID, FirstName FROM [Sheet1$]'
	)
SELECT 	ID, FirstName  
FROM #T

DROP TABLE #T


Remember, you have to have the Excel file closed while running the query.

In order to have the code above working PROBABLY you'll have to run also this code to enable *Ad Hoc Distributed Queries* usage.

EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO

GeneralRe: How to insert data from MS SQL server in MS EXCEL Sheet? Pin
guriqbal8720-Jul-08 20:50
guriqbal8720-Jul-08 20:50 
AnswerCross Post Pin
Paul Conrad17-Jul-08 16:51
professionalPaul Conrad17-Jul-08 16:51 
QuestionSending Email Pin
jonhbt17-Jul-08 3:38
jonhbt17-Jul-08 3:38 
AnswerRe: Sending Email Pin
Wendelius17-Jul-08 8:06
mentorWendelius17-Jul-08 8:06 
QuestionNested Cursor loop problem Pin
Member 387988117-Jul-08 3:25
Member 387988117-Jul-08 3:25 
AnswerRe: Nested Cursor loop problem Pin
Mark J. Miller17-Jul-08 9:27
Mark J. Miller17-Jul-08 9:27 
GeneralRe: Nested Cursor loop problem [modified] Pin
Member 387988117-Jul-08 19:59
Member 387988117-Jul-08 19:59 
GeneralRe: Nested Cursor loop problem Pin
Mark J. Miller18-Jul-08 5:20
Mark J. Miller18-Jul-08 5:20 
QuestionCompact database not working Pin
krishnan.s17-Jul-08 2:41
krishnan.s17-Jul-08 2:41 
AnswerRe: Compact database not working Pin
Paul Conrad17-Jul-08 16:51
professionalPaul Conrad17-Jul-08 16:51 
QuestionNot In operation? Pin
Member 387988117-Jul-08 1:03
Member 387988117-Jul-08 1:03 
AnswerRe: Not In operation? Pin
TheFM23417-Jul-08 3:00
TheFM23417-Jul-08 3:00 
GeneralRe: Not In operation? Pin
Member 387988117-Jul-08 3:09
Member 387988117-Jul-08 3:09 
Questionselect datas using union operation Pin
deepthy.p.m16-Jul-08 22:48
deepthy.p.m16-Jul-08 22:48 
AnswerRe: select datas using union operation Pin
Vimalsoft(Pty) Ltd17-Jul-08 0:50
professionalVimalsoft(Pty) Ltd17-Jul-08 0:50 
Questionreturn Table name + Column Name in sql query Pin
farabba16-Jul-08 20:51
farabba16-Jul-08 20:51 
AnswerRe: return Table name + Column Name in sql query Pin
Harvey Saayman16-Jul-08 23:01
Harvey Saayman16-Jul-08 23:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.