PC Review


Reply
Thread Tools Rate Thread

how do I import data in excel form SQL server?

 
 
Mitch
Guest
Posts: n/a
 
      14th Apr 2010
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
 
Reply With Quote
 
 
 
 
Duke Carey
Guest
Posts: n/a
 
      14th Apr 2010
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

 
Reply With Quote
 
Mitch
Guest
Posts: n/a
 
      14th Apr 2010
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

 
Reply With Quote
 
Duke Carey
Guest
Posts: n/a
 
      15th Apr 2010
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

 
Reply With Quote
 
Duke Carey
Guest
Posts: n/a
 
      15th Apr 2010
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

 
Reply With Quote
 
Mitch
Guest
Posts: n/a
 
      15th Apr 2010
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

 
Reply With Quote
 
Mitch
Guest
Posts: n/a
 
      15th Apr 2010
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

 
Reply With Quote
 
Duke Carey
Guest
Posts: n/a
 
      15th Apr 2010
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import Data from SQL server to excel abhay_547 Microsoft Excel Programming 0 18th May 2010 04:43 AM
RE: Import Excel Data to SQL Server Joel Microsoft Excel Programming 0 5th Aug 2009 11:26 AM
Import data from MS Sql Server to Excel =?Utf-8?B?bWVzYXJpbQ==?= Microsoft Excel Programming 1 29th Oct 2007 05:31 PM
Import Excel Data into SQL Server with VB.NET =?Utf-8?B?a2hhbmlm?= Microsoft Dot NET 6 9th Jun 2005 02:47 PM
Import excel data into SQL server -- ASP.net, C#, DTS -- how?? Rathtap Microsoft ASP .NET 0 30th Jun 2003 05:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:10 PM.