A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how do I import data in excel form SQL server?



 
 
Thread Tools Display Modes
  #1  
Old April 14th, 2010, 09:22 PM posted to microsoft.public.excel.worksheet.functions
Mitch
external usenet poster
 
Posts: 159
Default how do I import data in excel form SQL server?

Hello All,

I've been trying to import data into excel from our SQL server. I have
the sql script yielding the results. The real problem is when I use the data
connectivity wizard, it only allows you to select one table from the database
in your SQL server. However, my script involves two tables with a join. Any
ideas would be helpful

Thanks,

Mitch
  #2  
Old April 14th, 2010, 09:43 PM posted to microsoft.public.excel.worksheet.functions
Duke Carey
external usenet poster
 
Posts: 1,027
Default how do I import data in excel form SQL server?

Asuming you have rights on the Server, convert your 'script' (by which you
probably mean query?) into a view. If you don't have adequate rights, then
use MS Query to connect to SQL Server and use your query text there.

"Mitch" wrote:

Hello All,

I've been trying to import data into excel from our SQL server. I have
the sql script yielding the results. The real problem is when I use the data
connectivity wizard, it only allows you to select one table from the database
in your SQL server. However, my script involves two tables with a join. Any
ideas would be helpful

Thanks,

Mitch

  #3  
Old April 14th, 2010, 10:04 PM posted to microsoft.public.excel.worksheet.functions
Mitch
external usenet poster
 
Posts: 159
Default how do I import data in excel form SQL server?

Thanks Duke. Im really new to SQL. I have here a Server Management studio
and an SQL query analyzer. Which one should I use. Both could give me
results to grid. How do I change it into view? After this, what do I do to
connect the results to Excel(import)?

"Duke Carey" wrote:

Asuming you have rights on the Server, convert your 'script' (by which you
probably mean query?) into a view. If you don't have adequate rights, then
use MS Query to connect to SQL Server and use your query text there.

"Mitch" wrote:

Hello All,

I've been trying to import data into excel from our SQL server. I have
the sql script yielding the results. The real problem is when I use the data
connectivity wizard, it only allows you to select one table from the database
in your SQL server. However, my script involves two tables with a join. Any
ideas would be helpful

Thanks,

Mitch

  #4  
Old April 15th, 2010, 01:27 AM posted to microsoft.public.excel.worksheet.functions
Duke Carey
external usenet poster
 
Posts: 1,027
Default how do I import data in excel form SQL server?

Well, you're asking a lot.

You can use SQL Management Studio to convert your query into a view by using

Create View [viewname] as
and then paste in your query

then you execute that query and, if all goes well, you'll have a view. A
view is nothing more than a virtual table.

Alternatively, use your query in Excel. What version of Excel are you
using? In 2007, on the data tab, under From Other Sources you can find MS
Query. In 2003 it's under the Data menu somewhere. Use that to connect to
SQL and follow the prompts. Select one of your tables to get past the early
steps. Toward the end there is an option to edit the thing in MS Query. When
you get there, click on the SQL button and delete what is there, replacing it
with your query. Follow the steps to run the query and return the data to
your worksheet

"Mitch" wrote:

Thanks Duke. Im really new to SQL. I have here a Server Management studio
and an SQL query analyzer. Which one should I use. Both could give me
results to grid. How do I change it into view? After this, what do I do to
connect the results to Excel(import)?

"Duke Carey" wrote:

Asuming you have rights on the Server, convert your 'script' (by which you
probably mean query?) into a view. If you don't have adequate rights, then
use MS Query to connect to SQL Server and use your query text there.

"Mitch" wrote:

Hello All,

I've been trying to import data into excel from our SQL server. I have
the sql script yielding the results. The real problem is when I use the data
connectivity wizard, it only allows you to select one table from the database
in your SQL server. However, my script involves two tables with a join. Any
ideas would be helpful

Thanks,

Mitch

  #5  
Old April 15th, 2010, 12:05 PM posted to microsoft.public.excel.worksheet.functions
Duke Carey
external usenet poster
 
Posts: 1,027
Default how do I import data in excel form SQL server?

Here's a link, too, that might help. Go all the way to the bottom of the
page to read about MS Query

http://www.nickhodge.co.uk/gui/datam...taexamples.htm


"Mitch" wrote:

Thanks Duke. Im really new to SQL. I have here a Server Management studio
and an SQL query analyzer. Which one should I use. Both could give me
results to grid. How do I change it into view? After this, what do I do to
connect the results to Excel(import)?

"Duke Carey" wrote:

Asuming you have rights on the Server, convert your 'script' (by which you
probably mean query?) into a view. If you don't have adequate rights, then
use MS Query to connect to SQL Server and use your query text there.

"Mitch" wrote:

Hello All,

I've been trying to import data into excel from our SQL server. I have
the sql script yielding the results. The real problem is when I use the data
connectivity wizard, it only allows you to select one table from the database
in your SQL server. However, my script involves two tables with a join. Any
ideas would be helpful

Thanks,

Mitch

  #6  
Old April 15th, 2010, 03:21 PM posted to microsoft.public.excel.worksheet.functions
Mitch
external usenet poster
 
Posts: 159
Default how do I import data in excel form SQL server?

Got an error message that read " changed database context to [table name
inside the data base]. What does this mean?

"Duke Carey" wrote:

Well, you're asking a lot.

You can use SQL Management Studio to convert your query into a view by using

Create View [viewname] as
and then paste in your query

then you execute that query and, if all goes well, you'll have a view. A
view is nothing more than a virtual table.

Alternatively, use your query in Excel. What version of Excel are you
using? In 2007, on the data tab, under From Other Sources you can find MS
Query. In 2003 it's under the Data menu somewhere. Use that to connect to
SQL and follow the prompts. Select one of your tables to get past the early
steps. Toward the end there is an option to edit the thing in MS Query. When
you get there, click on the SQL button and delete what is there, replacing it
with your query. Follow the steps to run the query and return the data to
your worksheet

"Mitch" wrote:

Thanks Duke. Im really new to SQL. I have here a Server Management studio
and an SQL query analyzer. Which one should I use. Both could give me
results to grid. How do I change it into view? After this, what do I do to
connect the results to Excel(import)?

"Duke Carey" wrote:

Asuming you have rights on the Server, convert your 'script' (by which you
probably mean query?) into a view. If you don't have adequate rights, then
use MS Query to connect to SQL Server and use your query text there.

"Mitch" wrote:

Hello All,

I've been trying to import data into excel from our SQL server. I have
the sql script yielding the results. The real problem is when I use the data
connectivity wizard, it only allows you to select one table from the database
in your SQL server. However, my script involves two tables with a join. Any
ideas would be helpful

Thanks,

Mitch

  #7  
Old April 15th, 2010, 03:35 PM posted to microsoft.public.excel.worksheet.functions
Mitch
external usenet poster
 
Posts: 159
Default how do I import data in excel form SQL server?

Duke,

am using Excel 2003. In the edit query window, do I erase everything? the
connection text etc, select SQL as command type and then paste my
script/query on teh bottom dialog box? I get an error like the context was
changed, or it indicates that the table I selected from the database is
invalid and such.

"Duke Carey" wrote:

Well, you're asking a lot.

You can use SQL Management Studio to convert your query into a view by using

Create View [viewname] as
and then paste in your query

then you execute that query and, if all goes well, you'll have a view. A
view is nothing more than a virtual table.

Alternatively, use your query in Excel. What version of Excel are you
using? In 2007, on the data tab, under From Other Sources you can find MS
Query. In 2003 it's under the Data menu somewhere. Use that to connect to
SQL and follow the prompts. Select one of your tables to get past the early
steps. Toward the end there is an option to edit the thing in MS Query. When
you get there, click on the SQL button and delete what is there, replacing it
with your query. Follow the steps to run the query and return the data to
your worksheet

"Mitch" wrote:

Thanks Duke. Im really new to SQL. I have here a Server Management studio
and an SQL query analyzer. Which one should I use. Both could give me
results to grid. How do I change it into view? After this, what do I do to
connect the results to Excel(import)?

"Duke Carey" wrote:

Asuming you have rights on the Server, convert your 'script' (by which you
probably mean query?) into a view. If you don't have adequate rights, then
use MS Query to connect to SQL Server and use your query text there.

"Mitch" wrote:

Hello All,

I've been trying to import data into excel from our SQL server. I have
the sql script yielding the results. The real problem is when I use the data
connectivity wizard, it only allows you to select one table from the database
in your SQL server. However, my script involves two tables with a join. Any
ideas would be helpful

Thanks,

Mitch

  #8  
Old April 15th, 2010, 03:49 PM posted to microsoft.public.excel.worksheet.functions
Duke Carey
external usenet poster
 
Posts: 1,027
Default how do I import data in excel form SQL server?

Use the link to Nick Hodge's site. Nearly at the bottom of that page he
shows you how to get t0 MS Query. You don't change any of the connection
info or any of the preliminary screens.

When you get to the screen that allows you to Edit in MS Query, be sure to
choose that option and click Finish. Now you'll be in the actual query
designer and that is where you click on the SQL button on the toolbar. In
the window that pops up you replace all THAT TEXT with your query text from
SQL Server Mgt Studio. Then follow the rest of Nick's instructions

"Mitch" wrote:

Duke,

am using Excel 2003. In the edit query window, do I erase everything? the
connection text etc, select SQL as command type and then paste my
script/query on teh bottom dialog box? I get an error like the context was
changed, or it indicates that the table I selected from the database is
invalid and such.

"Duke Carey" wrote:

Well, you're asking a lot.

You can use SQL Management Studio to convert your query into a view by using

Create View [viewname] as
and then paste in your query

then you execute that query and, if all goes well, you'll have a view. A
view is nothing more than a virtual table.

Alternatively, use your query in Excel. What version of Excel are you
using? In 2007, on the data tab, under From Other Sources you can find MS
Query. In 2003 it's under the Data menu somewhere. Use that to connect to
SQL and follow the prompts. Select one of your tables to get past the early
steps. Toward the end there is an option to edit the thing in MS Query. When
you get there, click on the SQL button and delete what is there, replacing it
with your query. Follow the steps to run the query and return the data to
your worksheet

"Mitch" wrote:

Thanks Duke. Im really new to SQL. I have here a Server Management studio
and an SQL query analyzer. Which one should I use. Both could give me
results to grid. How do I change it into view? After this, what do I do to
connect the results to Excel(import)?

"Duke Carey" wrote:

Asuming you have rights on the Server, convert your 'script' (by which you
probably mean query?) into a view. If you don't have adequate rights, then
use MS Query to connect to SQL Server and use your query text there.

"Mitch" wrote:

Hello All,

I've been trying to import data into excel from our SQL server. I have
the sql script yielding the results. The real problem is when I use the data
connectivity wizard, it only allows you to select one table from the database
in your SQL server. However, my script involves two tables with a join. Any
ideas would be helpful

Thanks,

Mitch

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.