473,416 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Using both IS NULL and IS NOT NULL in Access 2000 Pass Through Query (for SQL Server 2000)

Hello, I'm in the process of changing our 'normal' Access 2000 update
queries to Update Pass Through Queries. We have a SQL server 2000
database and we're using an Access 2000 database as our front end.

In the criteria of one of our update query fields, we use both the
isnull(field1) and Not IsNull(field2) then Field3, otherwise, set the
updated field as null. Here's my converted Pass Through Query :

UPDATE Vsel SET
VSel.Cert1 = IIf(IsNull(VSel.Cert1), RenArch.Cert1),
VSel.Cert2 = IIf(IsNull(VSel.Cert2), RenArch.Cert2),
VSel.Cert3 = IIf(IsNull(VSel.Cert3), RenArch.Cert3),
VSel.Cert4 = IIf(IsNull(VSel.Cert4), RenArch.Cert4),
VSel.Cert1ExpDt = IIf(IsNull(BDACmpltDt) AND IS NOT NULL
(RenArch.Cert1), RenArch.CDDt),
VSel.Cert2ExpDt = IIf(IsNull(BOMSADtIssd) AND IS NOT NULL
(RenArch.Cert2), RenArch.CDDt),
VSel.Cert3ExpDt = IIf(IsNull(BDPMADtIssd) AND IS NOT NULL
(RenArch.Cert3), RenArch.CDDt),
VSel.Cert4ExpDt = IIf(IsNull(BOACmpltDt) AND IS NOT NULL
(RenArch.Cert4), RenArch.CDDt),
VSel.BDACmpltDt = IIf(IsNull(BDACmpltDt), RenArch.Cert1DOC),
VSel.BOACmpltDt = IIf(IsNull(BOACmpltDt), RenArch.Cert4DOC),
VSel.BDPMADtIssd = IIf(IsNull(BDPMADtIssd), RenArch.Cert3DOC),
VSel.BOMSADtIssd = IIf(IsNull(BOMSADtIssd), RenArch.Cert2DOC)
FROM VSel INNER JOIN RenArch ON VSel.SSN = RenArch.SSN

This is the original criteria in the access update query for line #6
(when I start to use both is null and is not null)
IIf(IsNull([BDACmpltDt]) And Not
IsNull([RenArch].[Cert1]),[RenArch].[CDDt],Null)

When I run this pass through query, I get an error telling me that the
IS Null function requires 2 arguments. I know the lines for

Can anyone help me with this.

I would certainly appreciate it.

JR

Dec 2 '05 #1
2 4410

IIF is an Access function it will fail in SQL Server, you need to use an
in-line case statement instead.

In SQL Server IsNull requires two parameters the first is teh var/field to
test the second is the value to reurn if it is Null, you test for Null using
var Is Null.

So your SQL becomes something like ...
UPDATE Vsel
SET
VSel.Cert1 = CASE WHEN VSel.Cert1 Is Null THEN RenArch.Cert1 ELSE
VSel.Cert1 END,
VSel.Cert2 = CASE WHEN VSel.Cert2 Is Null THEN RenArch.Cert2 ELSE
VSel.Cert2 END,
VSel.Cert3 = CASE WHEN VSel.Cert3 Is Null THEN RenArch.Cert3 ELSE
VSel.END,
VSel.Cert4 = CASE WHEN VSel.Cert4 Is Null THEN RenArch.Cert4 ELSE
VSel.Cert4 END,
VSel.Cert1ExpDt = CASE WHEN BDACmpltDt IS NULL AND RenArch.Cert1 IS NOT
NULL
THEN RenArch.CDDt ELSE VSel.Cert1ExpDt
END,
-- ... and so on ...

FROM VSel INNER JOIN RenArch ON VSel.SSN = RenArch.SSN

--
Terry Kreft

<IL***@NETZERO.NET> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
Hello, I'm in the process of changing our 'normal' Access 2000 update
queries to Update Pass Through Queries. We have a SQL server 2000
database and we're using an Access 2000 database as our front end.

In the criteria of one of our update query fields, we use both the
isnull(field1) and Not IsNull(field2) then Field3, otherwise, set the
updated field as null. Here's my converted Pass Through Query :

UPDATE Vsel SET
VSel.Cert1 = IIf(IsNull(VSel.Cert1), RenArch.Cert1),
VSel.Cert2 = IIf(IsNull(VSel.Cert2), RenArch.Cert2),
VSel.Cert3 = IIf(IsNull(VSel.Cert3), RenArch.Cert3),
VSel.Cert4 = IIf(IsNull(VSel.Cert4), RenArch.Cert4),
VSel.Cert1ExpDt = IIf(IsNull(BDACmpltDt) AND IS NOT NULL
(RenArch.Cert1), RenArch.CDDt),
VSel.Cert2ExpDt = IIf(IsNull(BOMSADtIssd) AND IS NOT NULL
(RenArch.Cert2), RenArch.CDDt),
VSel.Cert3ExpDt = IIf(IsNull(BDPMADtIssd) AND IS NOT NULL
(RenArch.Cert3), RenArch.CDDt),
VSel.Cert4ExpDt = IIf(IsNull(BOACmpltDt) AND IS NOT NULL
(RenArch.Cert4), RenArch.CDDt),
VSel.BDACmpltDt = IIf(IsNull(BDACmpltDt), RenArch.Cert1DOC),
VSel.BOACmpltDt = IIf(IsNull(BOACmpltDt), RenArch.Cert4DOC),
VSel.BDPMADtIssd = IIf(IsNull(BDPMADtIssd), RenArch.Cert3DOC),
VSel.BOMSADtIssd = IIf(IsNull(BOMSADtIssd), RenArch.Cert2DOC)
FROM VSel INNER JOIN RenArch ON VSel.SSN = RenArch.SSN

This is the original criteria in the access update query for line #6
(when I start to use both is null and is not null)
IIf(IsNull([BDACmpltDt]) And Not
IsNull([RenArch].[Cert1]),[RenArch].[CDDt],Null)

When I run this pass through query, I get an error telling me that the
IS Null function requires 2 arguments. I know the lines for

Can anyone help me with this.

I would certainly appreciate it.

JR

Dec 3 '05 #2
Hello Terry, I did what you suggested and it worked out perfectly.

Thanks!

Dec 6 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: polytimi8 | last post by:
Hello, I would like to know if it is possible to create a form in Access2000, which would function like a calendar for 8 operating rooms in hospital, showing which hours are those closed for a...
1
by: annie | last post by:
Hi all, I have recently ported my Access 2000 app to SQL Server, keeping the Access client as the front end using linked tables. I am also using triggers on my SQL tables to trap orphan...
6
by: Access Newbie | last post by:
I'm using Access 2000 and I'm trying to create a pass-through query to append all the data from a local table to a remote table. I'm using the SQL query editor in MS Access to create the query (I...
3
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are...
4
by: Tim Sapp | last post by:
Folks, I am working on a .Net web site that connects to SQL Server 2000 on another box. The DBA has given me a Domain user account with rights to the database and table. I have confirmed with...
2
by: me321701 | last post by:
I have an Access 2003 MDE with a SQL Server 2000 back-end using ODBC linked tables. The MDE is shared among approximately 20 users. This is the environment; I don't have the ability to change it...
0
by: anonieko | last post by:
This approach I found very efficient and FAST when compared to the rowcount, or Subquery Approaches. This is before the advent of a ranking function from DB such as ROW_NUMBER() in SQL Server...
8
by: rbg | last post by:
I did use query plans to find out more. ( Please see the thread BELOW) I have a question on this, if someone can help me with that it will be great. In my SQL query that selects data from table,...
2
by: gumby | last post by:
I would like to call this stored procedure, but I am unable to pass parameters to the @Start and @End. Is thier a way to pass parameters to a pass through query from MS Access? SELECT ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
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...
0
tracyyun
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...
0
agi2029
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.