From: Mitch on
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
From: Duke Carey on
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
From: Mitch on
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
From: Duke Carey on
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
From: Mitch on
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