473,670 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using DateAdd with ODBC drivers

1 New Member
Hi I have tried all kinds of formats and syntax I just can't get DateAdd to work with ODBC drivers...

System Windows NT PICWEB01 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) i586
ODBC library Win32
ODBCVER 0x0350

EG

Expand|Select|Wrap|Line Numbers
  1. [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
  2. SELECT DATEADD ("dd", -2, '#1969-12-31 20:00:00#') AS NextCalibration FROM TblCalibItems;
Expand|Select|Wrap|Line Numbers
  1. [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
  2. SELECT DATEADD ("second", -2, '2022-02-02') AS NextCalibration FROM TblCalibItems;
etc...
Apr 14 '22 #1
5 8070
isladogs
460 Recognized Expert Moderator Contributor
Perhaps I've got this wrong but it appears that you are writing this code in Access
If so, try

Expand|Select|Wrap|Line Numbers
  1. SELECT DATEADD ("d", -2, "#1969-12-31 20:00:00#") AS NextCalibration FROM TblCalibItems;
and
Expand|Select|Wrap|Line Numbers
  1. SELECT DATEADD ("s", -2, "#2022-02-02#") AS NextCalibration FROM TblCalibItems;
Apr 14 '22 #2
zmbd
5,501 Recognized Expert Moderator Expert
What is your backend?
What is your frontend?
The syntax can be quite specific to what FE and BE you are using... as seen here starting around post6:

home > topics > asp / active server pages > questions > dateadd in sql statement not working (Post#6)


[Edit] Did not see isladogs post to your question until after I had made mine due to it being in moderation status.; however, it follows along the same line as the thread I linked you to... syntax is everything :)
Apr 14 '22 #3
isladogs
460 Recognized Expert Moderator Contributor
Thanks @zmbd
I approved the OP's post but for some reason was unable to get my own reply to appear!
Apr 15 '22 #4
cactusdata
214 Recognized Expert New Member
DATEADD is not field of your table but a function, so try:

Expand|Select|Wrap|Line Numbers
  1. SELECT DateAdd("d", -2, "#1969-12-31 20:00:00#") AS NextCalibration FROM TblCalibItems;
Also, the correct arguments for DateAdd are required: DateAdd function.
Apr 15 '22 #5
NeoPa
32,569 Recognized Expert Moderator MVP
I would point you towards a few issues with your tests. Some have previously been identified / hinted at already.

Jet/ACE SQL allows both the appropriate SQL format quotes (') as well as the double-quotes ("). Mixing them, as you have, is probably also perfectly acceptable - even if it does look confused.

Acceptable values for the Interval parameter are listed in the article Cactus linked you to. Neither of "dd" nor "second" is in that list.

Some versions of SQL (T-SQL being an example) don't allow for date literal values and require a properly formatted date string (In such cases they require proper SQL quotes (') as delimiters). Access supports the same DateTime literals in SQL as it does in VBA. These require DateTime (Hash or Octothorp #) indicators and do not require string quotes, of any variety, around them. For more on what is acceptable for DateTimes see Literal DateTimes and Their Delimiters (#). You'll see there that your date formatting is otherwise optimal. Probably the best of the available standard SQL formats for them. Certainly the one with the least possibility of ambiguity.

I think, between us, we've explained every problem illustrated in your SQL code. I would just add, before I stop, my congratulations for formatting your question such that all the relevant information was available to us at the start.
Apr 15 '22 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
23770
by: paul tomlinson | last post by:
Hi folks - i've got a windows 2000 server (SP3) i've run the IIS lockdown tool on it and set for dynamic websites - all the static pages within the site work ok but an ASP section has been put in which now keeps giving me the error below : Microsoft OLE DB Provider for ODBC Drivers error '80004005' General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x404 Thread 0x6ac DBC 0xbd7014 Jet'.
15
1377
by: M P | last post by:
What does this mean? I am accessing an ASP page that queries Access Database thru fileDSN. I'm using IIS 5.0 Win2K SP4 Microsoft OLE DB Provider for ODBC Drivers error '80004005' General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x444 Thread 0xfe4 DBC 0x5200024 Jet'.
2
7331
by: john_20_28_2000 | last post by:
They are corrupt. I cannot get the odbc driver applet for sql server to open when I click add and I cannot configure any existing ones. And the usage of the drivers fail. Other ODBC drivers work. Does anyone know how to reinstall the SQL Server set of ODBC drivers? MDAC wouldn't install, said it was already at current level. Thanks for any ideas.
1
8722
by: MLH | last post by:
I'm running XP. Is it required that a given ODBC driver be selected or set somehow as a default driver? Look at this... Here's the error: Error: ODBC call failed... Datasource not found and no default ODBC driver specified. I think I can work my way around the Datasource, but the default driver thing (#0) - dunno?
0
1247
by: Mark | last post by:
Hi all, I was wondering if anybody knew if it was at all possible to install old odbc drivers (approx ver 3.5) instead of the standard windows XP (ver 4.0)? The reason I need to use 3.5 is because a piece of old software is being used needs to use the older drivers because of its age. Ive tried to manually copy older drivers (win98)and replace existing drivers but unfortunately windows automatically restores the orginal files on...
4
2665
by: hugh welford | last post by:
Hi - using XP pro with IIS to develop offline asp data access site. Suddenly, my DSNs and odbc drivers have disappeared - the only thing I can think of is that an XP auto update has done this in some way. Can anyone tell me how to get hold of and re-instal odbc drivers to allow me to connect with ACCESS data bases. Thanks Hugh
2
8513
by: pericpero | last post by:
Hi There seem to be a number of posts already with this error message but none of them have helped me ... I am trying to execute some dynamic SQL from an ASP form to update or delete from a table and I get the following output:- == SQL=Update StockItemMaterials set =3 WHERE ="P0855" AND ="GOGGW" Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
4
40331
by: ToddAndMargo | last post by:
Hi All, Okay. I give up. I need to install the latest ODBC drivers that work with Microsoft's SQL server 2000. (I am write a Lotus Approach front end to an existing sql2000 database.) I have looked all over Microsoft's download web site, but no joy (I may not have know what to search for or what the answer that came back meant.)
1
2786
by: jimbo905 | last post by:
My secretaries HD crashed - bummer. I got a new HD running XP pro with SP3. I have installed 8i client using the OUI (at first I had to rename symcjit.dll to symcjit_old.dll). All the components appeared to install. I used OUI to install the 8i ODBC drivers but when I go to ADMINISTRATIVE TOOLS/DATA SOURCES >>>SYSTEM DNS tab and try to add the 8i ODBC driver set it does not appear in the list Using Oracle's KB I found a list of all...
0
8466
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8384
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8901
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, 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...
0
8813
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 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...
1
8591
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,...
0
8659
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 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...
0
7412
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, 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...
1
6212
isladogs
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...
0
4208
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.