Group:  Microsoft Excel ยป microsoft.public.excel.querydao
Thread: sql problem

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

sql problem
ioshicumine 24.07.2006 07:35:01
Hi

I have a problem in excel when i try to import data from MSSql with Import
external data: I must use the same condition in two places in the same
query..something like that:

select col2 from d where col1=? union select col3 from d where id not in
(select col2 from d where col1=?)

this query works perfectly in MSSql, but when I try to do this in my ".dqy"
file the excel tell me I have an error in my sql...

pls help me

Re: sql problem
"Nick Hodge" <nick_hodgeTAKETHISOUT[ at ]zen.co.uk.ANDTHIS> 25.07.2006 19:14:28
I'm trying to confirm this in the knowledge base, but it appears to be down.
I am pretty sure you can't use parameters in union queries in MSQuery

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
nick_hodgeTAKETHISOUT[ at ]zen.co.uk.ANDTHIS
www.nickhodge.co.uk

"ioshicumine" <ioshicumine[ at ]discussions.microsoft.com> wrote in message
news:4A6BD3BD-4D4B-481C-9E51-EB41A2515C00[ at ]microsoft.com...
[Quoted Text]
> Hi
>
> I have a problem in excel when i try to import data from MSSql with Import
> external data: I must use the same condition in two places in the same
> query..something like that:
>
> select col2 from d where col1=? union select col3 from d where id not in
> (select col2 from d where col1=?)
>
> this query works perfectly in MSSql, but when I try to do this in my
> ".dqy"
> file the excel tell me I have an error in my sql...
>
> pls help me
>


Re: sql problem
eyeman6513_2000[ at ]yahoo.com 11.08.2006 02:59:39
What kind of paramters are you trying to use wiht MSQuery?

Typcially I do all my data manipulation in SQL and then use Excel to
show the data, I have found that this is easier and cleaner, just a
thought.

Richard

Nick Hodge wrote:
[Quoted Text]
> I'm trying to confirm this in the knowledge base, but it appears to be down.
> I am pretty sure you can't use parameters in union queries in MSQuery
>
> --
> HTH
> Nick Hodge
> Microsoft MVP - Excel
> Southampton, England
> nick_hodgeTAKETHISOUT[ at ]zen.co.uk.ANDTHIS
> www.nickhodge.co.uk
>
> "ioshicumine" <ioshicumine[ at ]discussions.microsoft.com> wrote in message
> news:4A6BD3BD-4D4B-481C-9E51-EB41A2515C00[ at ]microsoft.com...
> > Hi
> >
> > I have a problem in excel when i try to import data from MSSql with Import
> > external data: I must use the same condition in two places in the same
> > query..something like that:
> >
> > select col2 from d where col1=? union select col3 from d where id not in
> > (select col2 from d where col1=?)
> >
> > this query works perfectly in MSSql, but when I try to do this in my
> > ".dqy"
> > file the excel tell me I have an error in my sql...
> >
> > pls help me
> >

Re: sql problem
"DM Unseen" <dm.unseen[ at ]gmail.com> 14.08.2006 09:48:35
You can't, since the ODBC driver will try to parse your query (and
isn't very good at it) before conmitting it to the DBMS only quite
trivial queries can be parameterized.

DM unseen

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net