Home » RDBMS Server » Networking and Gateways » MS Excel SQL.REQUEST syntax to connect to Oracle
MS Excel SQL.REQUEST syntax to connect to Oracle [message #67195] Mon, 02 February 2004 05:06 Go to next message
Ciarano
Messages: 1
Registered: February 2004
Junior Member
<PRE class=OTbl style="WORD-WRAP: break-word">Hi guys

I'm trying to get my syntax correct for using sql.request.  In the Excel help the syntax is

SQL.REQUEST(connection_string,output_ref,driver_prompt,query_text,col_names_logical)

The connection string for Oracle is DNS=My Oracle Data Source;DBQ=MYSER VER;UID=JohnS;PWD=Sesame

My sql.request is

=SQL.REQUEST("DNS=dw92;DBQ=dw92;UID=sh1;PWD=sh1",C15,2,"select cost from cost_base_view",TRUE)

My database is dw92, I've declared my data source as dw92.dsn but I keep getting N/A

Can anyone help?</PRE><PRE class=OTbl style="WORD-WRAP: break-word">What about ExecuteSQL? Can anyone elaborate on using this function?</PRE><PRE class=OTbl style="WORD-WRAP: break-word">

Thanks

Ciaran</PRE>
Re: MS Excel SQL.REQUEST syntax to connect to Oracle [message #67426 is a reply to message #67195] Fri, 16 July 2004 11:54 Go to previous messageGo to next message
Ed Davis
Messages: 1
Registered: July 2004
Junior Member
Here's the syntax that I use and it works great.

=SQL.REQUEST("DSN=WDFR;UID=ABCD;PWD=1234",B2, 2,"Select description from edcdb.item_data where part_number = '"&$A$2&"'", FALSE)

Of course you have to change this to fit your environment.
Re: MS Excel SQL.REQUEST syntax to connect to Oracle [message #67473 is a reply to message #67426] Sun, 15 August 2004 18:06 Go to previous messageGo to next message
Geoff Merkel
Messages: 1
Registered: August 2004
Junior Member
=SQL.REQUEST("DSN=CLASP;UID=sa;PWD=;Database=CLASP",,,"Select Kkey from dbo.VA where VAF1 = ' "&$A$1&" ' ",FALSE)

This code is entered in cell A2 with the value of a product type (ie Poison) entered into cel A1.
... Note that I have added 3 extra spaces between the quotes that i used to define the cell to make it a bit easier to read. You will need to take these out before it will work.

Also the following works

=SQL.REQUEST("DSN=CLASP;UID=sa;PWD=;Database=CLASP",,,"Select Kkey from dbo.VA where VAF1 = ' "&A1&" ' or VAF1 = ' "&B1&" ' ",FALSE)

Cells A1 and B1 contain different product types

(I found that the cells definition do not need the $ signs)

It only returns a single field of a single record into the cell that contains the formula.

What I want is the code to return all product records (going down the worksheet) within the same product type (VAF1) and multiple fields as selected of each product record (ie. KKey, VAF2, VAF3, VAF4, etc.) starting in cell A2 to "Whatever".
Re: MS Excel SQL.REQUEST syntax to connect to Oracle [message #67503 is a reply to message #67473] Wed, 01 September 2004 07:52 Go to previous messageGo to next message
Christian
Messages: 15
Registered: February 2001
Junior Member
try to select under your formula the lines in which you want to have more record and press CTRL + Shift + Enter.
Re: MS Excel SQL.REQUEST syntax to connect to Oracle [message #67749 is a reply to message #67473] Thu, 17 February 2005 11:15 Go to previous message
ashish
Messages: 107
Registered: December 2000
Senior Member
I have a SQL Server database, but I have the same problem - SQL.Request only returns a singe row (I only have one column) in the cell where I entered SQL.Connect the formula. Any ideas how to fix this??
Previous Topic: how to access the parameters of TASK MANAGER in winXp
Next Topic: connecting to a remote oracle db by toad
Goto Forum:
  


Current Time: Wed May 01 01:23:05 CDT 2024