Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Simple Query Question

Author  Topic 

nicka
Starting Member

28 Posts

Posted - 2002-06-21 : 10:09:33
Using MSACCESS

I have Table "tblOP" with two fields in question "Status" and "LastModified"

I want to UPDATE the "status" field from HOLD to CANCELLED whenever "LastModified" is before 12/31/2001 or "LastModified" is blank

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-06-21 : 10:30:07
update tblop
set status = 'cancelled'
where status = 'Hold' and (LastModified = '' or LastModified < 12/31/2001)

-----------------------
Take my advice, I dare ya
Go to Top of Page

nicka
Starting Member

28 Posts

Posted - 2002-06-21 : 10:52:19
Why am I getting Data Type mismatch in criteria expression.

The LastModified Field is Date/Time
status is a Text field

Go to Top of Page

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2002-06-21 : 11:01:30
You will need to change the where clause to something like this:

where status = 'Hold' and (LastModified < '#12/31/2001#')

I'm not too sure about the use of # - has been a while since I used Access (fortunately!).
Go to Top of Page

nicka
Starting Member

28 Posts

Posted - 2002-06-21 : 11:17:23
Thanks I already figured that out. You 've been of great help.

Quick question for you. I am planning to upsize my database to SQL server soon. Any advice on improving speed and performance is SQL "backward compatible i.e. MSACCESS compatible". If not are there a lot of changes in my queries that I have to expect.


Go to Top of Page

M.E.
Aged Yak Warrior

539 Posts

Posted - 2002-06-21 : 11:21:07
Your best bet is to read through some of the articles on this site... Use the search to pull out articles on MS Access.

-----------------------
Take my advice, I dare ya
Go to Top of Page
   

- Advertisement -