Run SQL-Server Query in Excel

  • Thread starter Thread starter Maik Richter
  • Start date Start date
M

Maik Richter

Hi guys,

is there a way to run a SQL-query on a SQL-Server
within Excel?

(Is it possible to create any JOIN-querys and DATEDIFF-functions within
Excel-Microsoft Query?)

Thanks much guys,

Mike
 
Maik said:
Hi guys,

is there a way to run a SQL-query on a SQL-Server
within Excel?

Yes.
I don't know it in English but in Dutch it's in Data - Externe gegevens
ophalen - Nieuwe databasequery...
(Is it possible to create any JOIN-querys and DATEDIFF-functions
within Excel-Microsoft Query?)

I have not needed it before, but I couldn't imagine why not. SQL is
just SQL, right?
Have you tried to search using Google?
Have you tried the websites of Chip Pearson, John Walkenbach, and other
MVP's that are frequently quoted here?
 
i have an answer for you

throw excel out the window; and don't ever use it again.

it is a one-way street to inefficiency, duplicating business logic

it is literally a disease

use access for reporting and data entry.. access data projects
specifically
 
Another fictitious reply to a non-existent post just to get a rant into the
newsgroups - Petty beyond belief.
 
Access->SQL integration is MUCH more dependable than Excel-SQL integration

for example... you use Access Data Projects in order to write stored procs
and views

can Excel do that?

get a life MVP and learn a real program
 
Amedee said:
in Dutch it's in Data - Externe gegevens
ophalen - Nieuwe databasequery...

I don't know it in Dutch <g> but I think you are referring to MS Query.
In MS Query, SQL is not just SQL: it's either MS Query's SQL or it's
the DBMS's SQL.

Write the SQL on the DBMS Server e.g. QA in SQL Server. Copy and paste
the SQL text to the MS Query SQL window and it should work: MS Query
will not recognize the syntax as being its own so will send it
unaltered to the DBMS for execution. However there is a chance MS Query
will think it recognizes the syntax, try to interpret it and fail. The
best way round this is - ironically - to use some syntax proprietary to
the DBMS and not recognizable by MS Query e.g. the DATEDIFF function
should do the trick! Of course, now that you've taken the time to write
the SQL on the server, you may as well make it available to Excel via a
VIEW or PROCEDURE ...

Jamie.

--
 
Back
Top