Access 97
If I select New on the Query tab of the db window, and go staight to sql
view and type in the following for example:
INSERT INTO tblMyTable ( dtDate, txtAny)
VALUES (#2003-09-03#, 'blah');
and then save the query, close it, and then reopen by clicking the design
button so it opens in sql view. The sql has changed to:
INSERT INTO tblMyTable ( dtDate, txtAny)
SELECT #2003-09-03#, 'blah';
Both Access Help and ADH97 confirm that the _before saved_ version is the
correct syntax, and the query does what is expected of it in both forms, so
it isn't a life threatening situation. However, idle curiosity drives me to
ask the question in the subject line.
Anyone got any thoughts on the subject?
Cheers
Peter 13 4109
Peter James wrote: Access 97 If I select New on the Query tab of the db window, and go staight to sql view and type in the following for example:
INSERT INTO tblMyTable ( dtDate, txtAny) VALUES (#2003-09-03#, 'blah');
and then save the query, close it, and then reopen by clicking the design button so it opens in sql view. The sql has changed to:
INSERT INTO tblMyTable ( dtDate, txtAny) SELECT #2003-09-03#, 'blah';
Both Access Help and ADH97 confirm that the _before saved_ version is the correct syntax, and the query does what is expected of it in both forms, so it isn't a life threatening situation. However, idle curiosity drives me to ask the question in the subject line.
Who knows? My guess is that it's Access' canonical form for
inserting constant values. The use of an illegal form of
the Select statement is kind of intriguing though!?
BTW, somewhere in Help there is a warning that they will do
this and that you should not worry about it.
--
Marsh
"Peter James" <ow****@yahoo.co.uk> wrote in message
news:bj**********@codas.jet.uk... Access 97 If I select New on the Query tab of the db window, and go staight to sql view and type in the following for example:
INSERT INTO tblMyTable ( dtDate, txtAny) VALUES (#2003-09-03#, 'blah');
and then save the query, close it, and then reopen by clicking the design button so it opens in sql view. The sql has changed to:
INSERT INTO tblMyTable ( dtDate, txtAny) SELECT #2003-09-03#, 'blah';
Both Access Help and ADH97 confirm that the _before saved_ version is the correct syntax, and the query does what is expected of it in both forms,
so it isn't a life threatening situation. However, idle curiosity drives me
to ask the question in the subject line.
Anyone got any thoughts on the subject?
Cheers
Peter
It can be even more frustrating when you have very long and complex queries
which (in order to make some sense out of them) you lay out in a legible
fashion with spaces, carriage returns, etc. Not only is all formatting
lost, but unnecessary extra stuff is often written in - such as prefixing
the field with the table name.
Where this is important, I save the SQL to a text file, edit it in Notepad
and paste it into the Access query.
Fletcher
On Wed, 3 Sep 2003 12:14:46 +0100 in comp.databases.ms-access, "Peter
James" <ow****@yahoo.co.uk> wrote: Access 97 If I select New on the Query tab of the db window, and go staight to sql view and type in the following for example:
INSERT INTO tblMyTable ( dtDate, txtAny) VALUES (#2003-09-03#, 'blah');
and then save the query, close it, and then reopen by clicking the design button so it opens in sql view. The sql has changed to:
INSERT INTO tblMyTable ( dtDate, txtAny) SELECT #2003-09-03#, 'blah';
Both Access Help and ADH97 confirm that the _before saved_ version is the correct syntax, and the query does what is expected of it in both forms, so it isn't a life threatening situation. However, idle curiosity drives me to ask the question in the subject line.
Anyone got any thoughts on the subject?
One of the fundamental differences I find between writing queries in
Access and views in SQL Server is that Access nicely remembers the
positions, sizes, etc of the tables above the query grid, SQL Server
doesn't.
I know in SQL Server it saves the SQL text as the view and builds the
tables & joins diagram on the fly.
I think (and I may be wrong as I don't know the internals of it) that
Access does the opposite and stores all those attributes, table
positions, etc for the diagram and generates the SQL Text on the fly.
--
A)bort, R)etry, I)nfluence with large hammer.
(replace sithlord with trevor for email)
Surely #2003-09-03# has got to be wrong?
#...# date constants must be expressed in American (month/day/year) order,
regardless of the system locale.
TC
"Peter James" <ow****@yahoo.co.uk> wrote in message
news:bj**********@codas.jet.uk... Access 97 If I select New on the Query tab of the db window, and go staight to sql view and type in the following for example:
INSERT INTO tblMyTable ( dtDate, txtAny) VALUES (#2003-09-03#, 'blah');
and then save the query, close it, and then reopen by clicking the design button so it opens in sql view. The sql has changed to:
INSERT INTO tblMyTable ( dtDate, txtAny) SELECT #2003-09-03#, 'blah';
Both Access Help and ADH97 confirm that the _before saved_ version is the correct syntax, and the query does what is expected of it in both forms,
so it isn't a life threatening situation. However, idle curiosity drives me
to ask the question in the subject line.
Anyone got any thoughts on the subject?
Cheers
Peter
Thanks to everyone for your responses. I guess we'll have to call it a
hidden <feature> ;-)
Peter
On Thu, 4 Sep 2003 07:49:06 +0100, "Peter James" <ow****@yahoo.co.uk>
wrote: "TC" <a@b.c.d> wrote in message news:1062645079.633666@teuthos... Surely #2003-09-03# has got to be wrong?
#...# date constants must be expressed in American (month/day/year) order, regardless of the system locale.
TC
Run the query and then look in the table and you'll find the date stored as 03/09/2003 (if you're the UK) -- yyyy-mm-dd is an acceptable input format, and also works in SQL Server I believe.
That's not what he meant. The date isn't actually stored as any format,
it's stored as a floating point number. It's just that Access normally
insists on converting any date expressions in queries into USA format.
- Steve Jorgensen
----
I would have written you a shorter program,
but I didn't have the time.
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:p0********************************@4ax.com... "TC" <a@b.c.d> wrote in message news:1062645079.633666@teuthos... Surely #2003-09-03# has got to be wrong?
#...# date constants must be expressed in American (month/day/year)
order, regardless of the system locale.
TC
That's not what he meant. The date isn't actually stored as any format, it's stored as a floating point number. It's just that Access normally insists on converting any date expressions in queries into USA format.
- Steve Jorgensen
I know that dates are stored as doubles, but you don't input a double. The
yyyy-mm--dd format is unambiguous.
Well here it is from a far more knowledgeable person than I: http://groups.google.com/groups?dq=&...8&selm=uLm3ptW
cDHA.3872%40TK2MSFTNGP11.phx.gbl
Apologies for word wrap.
On Thu, 4 Sep 2003 12:47:33 +0100, "Peter James" <ow****@yahoo.co.uk>
wrote: "Steve Jorgensen" <no****@nospam.nospam> wrote in message news:p0********************************@4ax.com.. . >"TC" <a@b.c.d> wrote in message news:1062645079.633666@teuthos... >> >> Surely #2003-09-03# has got to be wrong? >> >> #...# date constants must be expressed in American (month/day/year)order, >> regardless of the system locale. >> > >TC
That's not what he meant. The date isn't actually stored as any format, it's stored as a floating point number. It's just that Access normally insists on converting any date expressions in queries into USA format.
- Steve Jorgensen
I know that dates are stored as doubles, but you don't input a double. The yyyy-mm--dd format is unambiguous.
Well here it is from a far more knowledgeable person than I:
http://groups.google.com/groups?dq=&...8&selm=uLm3ptW cDHA.3872%40TK2MSFTNGP11.phx.gbl
Apologies for word wrap.
No argument with that information, but when I'm in the query editor, and I
type a date in yyy-mm-dd format (and yes, I do line that format because it
is unambiguous), Access rewrites it as #mm/dd/yy#. I'm wondering why it
does not mangle your query in the same way.
- Steve Jorgensen
----
I would have written you a shorter program,
but I didn't have the time. ow****@yahoo.co.uk (Peter James) wrote in
<bj**********@codas.jet.uk>: Access 97 If I select New on the Query tab of the db window, and go staight to sql view and type in the following for example:
INSERT INTO tblMyTable ( dtDate, txtAny) VALUES (#2003-09-03#, 'blah');
and then save the query, close it, and then reopen by clicking the design button so it opens in sql view. The sql has changed to:
INSERT INTO tblMyTable ( dtDate, txtAny) SELECT #2003-09-03#, 'blah';
Both Access Help and ADH97 confirm that the _before saved_ version is the correct syntax, . . .
"Correct syntax?"
Where, exactly, do you get this.
VALUES is something that Jet SQL supports, but I don't believe it's
native Jet SQL.
. . . and the query does what is expected of it in both forms, so it isn't a life threatening situation. However, idle curiosity drives me to ask the question in the subject line.
Why?
Because Access is getting parsing the query for the Jet query
optimizer, which probably expects SQL in a certain format. While I
see no reason why the Jet query optimizer could not accept both
forms, apparently it does not, or it did not at the time the Access
QBE interface was designed.
Why worry about it?
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
On Thu, 4 Sep 2003 16:14:57 +0100, "Peter James" <ow****@yahoo.co.uk>
wrote: "Steve Jorgensen" <no****@nospam.nospam> wrote in message news:9b********************************@4ax.com.. . No argument with that information, but when I'm in the query editor, and I type a date in yyy-mm-dd format (and yes, I do line that format because it is unambiguous), Access rewrites it as #mm/dd/yy#. I'm wondering why it does not mangle your query in the same way.
- Steve Jorgensen
Are you in the USA? If so Access won't have any regional settings to cope with because the default is US format, and perhaps that is why the date constant in your query gets changed. Just a guess.
Jet requires US format no matter where one is in the world, but Access uses the regional settings to accept and display local date formats and does the conversion to/from US format when sending/retrieving data to/from Jet.
There's a thread entitled regional differences over in m.p.a.queries that might be of interest.
I see we're still not communicating. In previous threads on date values in
queries, it has come up that Access was rewriting date constant strings to
USA format no matter how you type them in. You could type an ISO date into
an expression, hit tab, and it got converted to USA format. This had
nothing to do with default settings for forms, reports, datasheet view, or
anything else. It was in the query editor only.
- Steve Jorgensen
----
I would have written you a shorter program,
but I didn't have the time.
David
Responses in line.
"David W. Fenton" <dX********@bway.net> wrote "Correct syntax?"
Where, exactly, do you get this.
Access Help>>SQL Reference>>INSERT INTO
and Access97 Developers Handbook pages 176-177.
VALUES is something that Jet SQL supports, but I don't believe it's native Jet SQL.
Huh? . . . and the query does what is expected of it in both forms, so it isn't a life threatening situation. However, idle curiosity drives me to ask the question in the subject line.
Why?
Because Access is getting parsing the query for the Jet query optimizer, which probably expects SQL in a certain format. While I see no reason why the Jet query optimizer could not accept both forms, apparently it does not, or it did not at the time the Access QBE interface was designed.
So, why to Microsoft and Messrs Getz, Litwin, Gilbert tell us otherwise?
That's a rhetorical question. Why worry about it?
I don't.
Subject closed.
Peter
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:ep********************************@4ax.com... I see we're still not communicating.
So it would seem. Date formats other than US work for me. What more can I
say?
Peter ow****@yahoo.co.uk (Peter James) wrote in
<bj**********@codas.jet.uk>: "David W. Fenton" <dX********@bway.net> wrote
"Correct syntax?"
Where, exactly, do you get this. Access Help>>SQL Reference>>INSERT INTO
You mean:
Access Help>>SQL>>INSERT INTO
There is no listing for "SQL Reference".
and Access97 Developers Handbook pages 176-177.
That's an almost verbatim quotation from the help file, so I don't
see it as an independent source. VALUES is something that Jet SQL supports, but I don't believe it's native Jet SQL.
Huh?
Often when multiple dialects for doing something are supported, one
is native and the other is ported behind the scenes to the native
version. So far as I can tell, the VALUES() method is not the
native method for Jet SQL, otherwise, it would be left alone by the
QBE SQL parser.
But I'm only guessing here. > . . . and the query does what is expected of it >in both forms, so it isn't a life threatening situation. >However, idle curiosity drives me to ask the question in the >subject line.
Why?
Because Access is getting parsing the query for the Jet query optimizer, which probably expects SQL in a certain format. While I see no reason why the Jet query optimizer could not accept both forms, apparently it does not, or it did not at the time the Access QBE interface was designed.
So, why to Microsoft and Messrs Getz, Litwin, Gilbert tell us otherwise? That's a rhetorical question.
Do you really think that everything that appears in published
reference works on complex software like Access has been 100%
independently verified by the authors? Much of what they do is
rework the existing documentation and try things out for
themselves. I'm pretty certain the reason that there is nothing in
the ADH about SELECT value1, value2, value3 in place of
VALUES(value1, value2, value3) is because the authors simply
confirmed that the syntax in the help file worked and did not
investigate if there were other syntaxes that worked.
Also, keep in mind that the change occurs in a saved query. How
often do you save an insert query with hardwired values for the
inserted row? The VALUES() syntax is very clear for writing SQL in
code and it works. The fact that it gets changed to the SELECT
syntax really doesn't matter much. Why worry about it?
I don't.
Subject closed.
Seems reasonable to me!
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: |
last post by:
If I need to check if a certain value does exist in a field, and return
either "yes" or "not" which query would be the most effestive?
|
by: Ken |
last post by:
I have a win 2000 database of autographs and scanned photos. They are
in the SAME directory. In the table, my "ImagePath" text field shows
JUST the image name (i.e. "blank.jpg"). I have an image...
|
by: HJ |
last post by:
Hi all,
I notice that the Form_Dirty event does not fire in Access 2002 (SP-1) when
the first character is typed into a new record. In previous versions of
Access it does fire.
For existing...
|
by: Bob |
last post by:
Having trouble getting started.
I created an instance of MSDE called VSDOTNET on a computer with the
name of sysdev.
Using MS SQL Web Adminstrator I created a database called temp with a...
|
by: Olivogt |
last post by:
Hello,
I was just puting an application on the web server but it did not work as
usual...
- I do develop on my notebook and move released applications to the Web server
- both have Sql Server...
|
by: ssp |
last post by:
G'Day All,
I have a web application sitting on my laptop and a Sql Server 2000
database on our INTRANET server running Windows 2003. Up until recently
I was able to access the database using my...
|
by: TheBurgerMan |
last post by:
Hi all. I am using W2K3, .NET2 on a machine running AD and Exchange. I
started getting the message below last week. I googled the error and not
much was returned, but I did find this;...
|
by: Atia Amin |
last post by:
Hi,
I am a new member. Hello to every one. I am new in ASP.NET area. I wrote an ASP.NET web application which was running ok with my old laptop. Currently I have given a new laptop. Now I copied...
|
by: Sh4wn |
last post by:
Hi,
first, python is one of my fav languages, and i'll definitely keep
developing with it. But, there's 1 one thing what I -really- miss:
data hiding. I know member vars are private when you...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |