Disappearing SQL Code in Queries (1 Viewer)

jdraw

Super Moderator
Staff member
Local time
Today, 16:54
Joined
Jan 23, 2006
Messages
15,379
@RogerCooper

You said
All that remains is the first clause such as "SELECT DISTINCTROW TOP 7" while all the remaining code is gone.

Have you tried to debug.print yourQueryName.sql? repeatedly, until more SQL is printed??
Can you post the "remaining or full code" from backups?

You have not continued to participate in this thread---has something changed?
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 21:54
Joined
Jan 14, 2017
Messages
18,219
Because there isn't one in the SQL the OP posted and SQL IS the query design.

I've checked again &still can't find any SQL in any of the posts written by the OP.
Perhaps you would be kind enough to tell me which post number as I must have missed it
 

static

Registered User.
Local time
Today, 21:54
Joined
Nov 2, 2015
Messages
823
SELECT DISTINCTROW TOP 7

That is (invalid) SQL.

If you tried to save it, Access (w)(sh)ouldn't let you.

SELECT DISTINCTROW TOP 7 FROM TABLE ...
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 21:54
Joined
Jan 14, 2017
Messages
18,219
Its perfectly valid if you include at least one field!

For example:
Code:
SELECT DISTINCTROW TOP 7 Postcodes.PostcodeArea, Postcodes.Postcode FROM Postcodes;



He said it was truncated at SELECT DISTINCTROW TOP 7 - not that was how it was originally
 

Attachments

  • QueryTop7DistinctRow.PNG
    QueryTop7DistinctRow.PNG
    9 KB · Views: 153

static

Registered User.
Local time
Today, 21:54
Joined
Nov 2, 2015
Messages
823
No. If the SQL was how it was originally the OP wouldn't be posting here.

The SQL is invalid!!! That is all we know.

You cannot save SQL like that in Access. Either it is being displayed incorrectly!!!? Which is very unlikely!! (weird bug) ... Or the query(s) are being corrupted. By what/why/how is the question!...
 

isladogs

MVP / VIP
Local time
Today, 21:54
Joined
Jan 14, 2017
Messages
18,219
This was the first post by the OP:

Each day, I run a long series of queries, the results of which are e-mailed. Sometimes, most of the SQL code in the query disappears after sending the e-mail. All that remains is the first clause such as "SELECT DISTINCTROW TOP 7" while all the remaining code is gone. The e-mail itself has the correct data.

This is long-standing problem, but it has been getting worse lately. I keep a table that has all the SQL code for queries so I can restore it easily, but it would be better if I did not need to do so. I repair/compact daily.

Does anyone know anything about this bug?

Its now post 46 and the OP has added very little info since post 1
The whole point is that it doesn't make sense to any of us (or the OP)
As he hasn't provided anything substantial since then, we're all basically wasting our time
 

Users who are viewing this thread

Top Bottom