Hello all,
I'm trying to write a multi-statement table function that returns a table of addresses from a remote database (Oracle) using OpenQuery and I'm having a hard time getting it to work with the 1 variable constraint it has (provider ID)
The code is below: -
SET ANSI_NULLS ON
-
GO
-
SET QUOTED_IDENTIFIER ON
-
GO
-
-
CREATE FUNCTION pmf_udfProviderChangeAddressTable
-
(
-
-- Add the parameters for the function here
-
@ProviderID varchar(20)
-
)
-
RETURNS @AddressTable TABLE
-
(
-
-- Add the column definitions for the TABLE variable here
-
ContactType varchar(4),
-
ContactAddr1 varchar(100),
-
ContactAddr2 varchar(100),
-
ContactCity varchar(40),
-
ContactState varchar(3),
-
ContactZip varchar(10),
-
ContactPhone varchar(20),
-
ContactFax varchar(20)
-
)
-
AS
-
BEGIN
-
-
DECLARE @SQL As varchar(500)
-
SET @SQL = 'SELECT CONTACT_TYPE As ContactType, FIRM_NAME As ContactAddr1,
-
ADDRESS_LINE1 As ContactAddr2, CITY AS ContactCity, STATE As ContactState, ZIP_CODE As ContactZip,
-
PHONE_NBR As ContactPhone, FAX_NBR As ContactFax FROM NET$.CONTACTS
-
WHERE PROV_ID = ''' + @ProviderID + ''' AND
-
(CONTACT_TYPE = ''01'' OR CONTACT_TYPE = ''02'')'
-
-
-
-- Add the SELECT statement with parameter references here
-
EXEC('INSERT INTO @AddressTable SELECT * FROM OPENQUERY(ENCP, ' + @SQL + ')'
-
-
RETURN
-
END
-
GO
-
I keep getting this error:
Msg 156, Level 15, State 1, Procedure pmf_udfProvider ChangeAddressTa ble, Line 33
Incorrect syntax near the keyword 'RETURN'.
Let me know if you need any more info.
Thank you!
Zach
1 4375 ck9663 2,878
Recognized Expert Specialist
I think you're missing one close parenthesis on your EXEC statement. You have ')' to close the OPENQUERY, but missing one to close the EXEC statement.
-- CK
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: rdh |
last post by:
Hi all,
I am in process of developing a Server in C++ supporting multiple
protocols. The server will be exposing various functionalities, and the
clients can communicate over any of the protocols may be TCP, IPX, SAP,
NETBEUI to access the server to access the functionalities exposed. The
server doesnot know in advance which client is using what protocol.
ALSO, ALL THE INTERACTION WILL BE MADE OVER XML.
example my server has...
|
by: Zorba.GR |
last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64
bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite
Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager Express
Edition v1.3.2 Win, IBM Tivoli System Automation v1.2.0 Linux, IBM
Tivoli Workload Scheduler Virtualized Data Centers v8.2 , other
IBM Tivoli CDs, WEBSPHERE EVERYPLACE MOBILE PORTAL v5.0 - ALTIUM , other IBM WebSphere Business CDs...
|
by: Zeng |
last post by:
I just realized that there are 2 modes for garbage collection modes: server
gs and workstation gs. Would someone know how I can go about changing the
mode for my web application written in C#? I want to make sure it's using
server gs mode. Thank you for any comment or advice.
-zeng
|
by: Danieltbt05 |
last post by:
just installed SQL server 2000 and using my client , i can't locate
the server. I used SQL query analyzer to search but no servers were
found. Error message is as below
Server : Msg17,level 16, state1
SQL server does not exist
or denied access.
|
by: NiponW |
last post by:
Hi,
I have SQL SERVER 2000 SP4 Enterprise , Windows 2003
Enterprise on
Xeon 4 Processors (now with multi-threading CPU) and I have
questions which
seem weirds to me (used to have the same config without
Multi-Threading) as following:
1. SQL Server see 8 CPUs. Is this because of
multi-threading CPUs ?
2. when use SP_WHO2 ACTIVE ,
| |
by: dorpnospam |
last post by:
We have an old but very critical application that was written in VB 6
against Access 95 dbs. We need to ditch this decrepit old unstable db
platform but we are trying to determine the best migration path to SQL
Server.
I am researching options. I started by upgrading a sample db to Access
2003 and update the VB 6 app to use DAO 3.6. That works well.
Next I tried upsizing the application to SQL Server and that works as
well but it...
|
by: TC |
last post by:
Like a lot of database developers, I often choose Jet for the back-
end. I'm starting to worry about what will happen when Jet is
deprecated. Ostensibly, Jet users like me must switch to SQL Server
(or MSDE / SQL Express), but there's something I just don't
understand.
Without Jet, how will we create file server database applications? In
other words, how will we create multi-user apps which use a file
server to share data and don't...
|
by: uninvitedm |
last post by:
I'm making a JSP page where (ideally) you select files to upload, each selected file is added to a listbox. The form is submit, (along with some other parameters), and the files are uploaded. They arent uploaded (written) tradionally to a server, I just need the file's input stream to pass to a method elsewhere (which will upload to a database).
The page has a file-input type to locate files to upload. Once a file is selected (onChange()),...
|
by: praveenkumarvpk |
last post by:
Hi friends Please help me!
Following is my servlet-code
import java.util.Enumeration;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import com.oreilly.servlet.MultipartRequest;
|
by: Guillermo_Lopez |
last post by:
Hello,
Our company has developed several Access applications for our clients
and we wish to expand to use a database server. We wish to use Access
as the front end application and SQL Server 2005 as the back end
Databes Server. Making a Server-Client application database.
I'm very new to SQL Server so my concern is how the licensing works
for a developer like us. I am aware that we can purchase the Developer
edition for $49 USD. Our...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |