Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Karl Burrows
 
Posts: n/a
Default Excel Database Query String Too Long

Hi!

I am trying to update a workbook (2002, 2003 versions) to remove many of the
values from an Access database query. The database is old and contains many
old records, so I am trying to make the workbooks a little faster by not
updating those records. The problem is I can not get all the excludes in
the field before it runs out of characters. Is there a better way to
exclude records? Here is the SQL query:

<'BLH ~ Blakeney Heath' And <'BRK ~ Brookmere' And <'LDP ~ Lake Davidson
Park' And <'MDW ~ Meadowmont at Highland Creek' And <'WGR ~ Withers Grove'
And <'WGV ~ Withers Grove V' And <'GLB ~ Glyndebourne'

I need to add several more and will be adding as the years progress. I am
working on getting them to "archive" older projects, so we don't have to
exclude so many.

Any help would be appreciated! Thanks!


  #2   Report Post  
keepITcool
 
Posts: n/a
Default


wouldn't it be easier to either:
either add a boolean field to the DB named : Archived? or somthing.

or create a table of Ärchived Projects and then create an query like
SELECT Customers.*
FROM Customers LEFT JOIN Archived ON
Customers.CompanyName = Archived.CompanyName
WHERE Archived.CompanyName Is Null;

.... that would make maintenance a whole lot easier than
changing your queries all the time...



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Karl Burrows wrote :

Hi!

I am trying to update a workbook (2002, 2003 versions) to remove many
of the values from an Access database query. The database is old and
contains many old records, so I am trying to make the workbooks a
little faster by not updating those records. The problem is I can
not get all the excludes in the field before it runs out of
characters. Is there a better way to exclude records? Here is the
SQL query:

<'BLH ~ Blakeney Heath' And <'BRK ~ Brookmere' And <'LDP ~ Lake
Davidson Park' And <'MDW ~ Meadowmont at Highland Creek' And <'WGR
~ Withers Grove' And <'WGV ~ Withers Grove V' And <'GLB ~
Glyndebourne'

I need to add several more and will be adding as the years progress.
I am working on getting them to "archive" older projects, so we don't
have to exclude so many.

Any help would be appreciated! Thanks!

  #3   Report Post  
Karl Burrows
 
Posts: n/a
Default

Yes, at some point, that would be a good idea!

"keepITcool" wrote in message
ft.com...

wouldn't it be easier to either:
either add a boolean field to the DB named : Archived? or somthing.

or create a table of Ärchived Projects and then create an query like
SELECT Customers.*
FROM Customers LEFT JOIN Archived ON
Customers.CompanyName = Archived.CompanyName
WHERE Archived.CompanyName Is Null;

.... that would make maintenance a whole lot easier than
changing your queries all the time...



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Karl Burrows wrote :

Hi!

I am trying to update a workbook (2002, 2003 versions) to remove many
of the values from an Access database query. The database is old and
contains many old records, so I am trying to make the workbooks a
little faster by not updating those records. The problem is I can
not get all the excludes in the field before it runs out of
characters. Is there a better way to exclude records? Here is the
SQL query:

<'BLH ~ Blakeney Heath' And <'BRK ~ Brookmere' And <'LDP ~ Lake
Davidson Park' And <'MDW ~ Meadowmont at Highland Creek' And <'WGR
~ Withers Grove' And <'WGV ~ Withers Grove V' And <'GLB ~
Glyndebourne'

I need to add several more and will be adding as the years progress.
I am working on getting them to "archive" older projects, so we don't
have to exclude so many.

Any help would be appreciated! Thanks!



  #4   Report Post  
Jamie Collins
 
Posts: n/a
Default


Karl Burrows wrote:
I can not get all the excludes in
the field before it runs out of characters. Is there a better way to


exclude records? Here is the SQL query:

<'BLH ~ Blakeney Heath' And <'BRK ~ Brookmere' And <'LDP ~ Lake

Davidson
Park' And <'MDW ~ Meadowmont at Highland Creek' And <'WGR ~ Withers

Grove'
And <'WGV ~ Withers Grove V' And <'GLB ~ Glyndebourne'

I need to add several more and will be adding as the years progress.

I am
working on getting them to "archive" older projects, so we don't have

to
exclude so many.


Using the SQL IN keyword uses less characters:

client_name NOT IN ('BLH ~ Blakeney Heath','BRK ~ Brookmere','LDP ~
Lake Davidson
Park','MDW ~ Meadowmont at Highland Creek',...)

However, AFAIK this will not prevent your query from become 'too
complex' when it gets to the parser because the statements are
logically equivalent.

Does your data have a more efficient key than this column (VARCHAR(50)
is it?) If not, are the first three characters unique e.g. could you
use:

LEFT(client_name, 3) NOT IN ('BLH','BRK','LDP','MDW', ...)

Whatever you key, it would be more efficient to maintain a list in a
ToBeArchived table and use this in a JOIN e.g.

SELECT T1.client_name
FROM MyTable AS T1
LEFT JOIN ToBeArchived AS T2
ON T1.client_name = T2.client_name
WHERE T2.client_name IS NULL;

If preferred, you may even be able to maintain this table in Excel and
create the JOIN across databases e.g.

SELECT T1.client_name
FROM
[MS Access;Database=C:\MyJetDB.mdb;].MyTable AS T1
LEFT JOIN
[Excel 8.0;HDR=YES;Database=C:\MyWorkbook.xls;].[ToBeArchived$] AS
T2
ON T1.client_name = T2.client_name
WHERE T2.client_name IS NULL;

Jamie.

--

  #5   Report Post  
Karl Burrows
 
Posts: n/a
Default

I think using LEFT(Subdivision,3) NOT IN will work perfectly!

Thanks!

"Jamie Collins" wrote in message
ups.com...

Karl Burrows wrote:
I can not get all the excludes in
the field before it runs out of characters. Is there a better way to


exclude records? Here is the SQL query:

<'BLH ~ Blakeney Heath' And <'BRK ~ Brookmere' And <'LDP ~ Lake

Davidson
Park' And <'MDW ~ Meadowmont at Highland Creek' And <'WGR ~ Withers

Grove'
And <'WGV ~ Withers Grove V' And <'GLB ~ Glyndebourne'

I need to add several more and will be adding as the years progress.

I am
working on getting them to "archive" older projects, so we don't have

to
exclude so many.


Using the SQL IN keyword uses less characters:

client_name NOT IN ('BLH ~ Blakeney Heath','BRK ~ Brookmere','LDP ~
Lake Davidson
Park','MDW ~ Meadowmont at Highland Creek',...)

However, AFAIK this will not prevent your query from become 'too
complex' when it gets to the parser because the statements are
logically equivalent.

Does your data have a more efficient key than this column (VARCHAR(50)
is it?) If not, are the first three characters unique e.g. could you
use:

LEFT(client_name, 3) NOT IN ('BLH','BRK','LDP','MDW', ...)

Whatever you key, it would be more efficient to maintain a list in a
ToBeArchived table and use this in a JOIN e.g.

SELECT T1.client_name
FROM MyTable AS T1
LEFT JOIN ToBeArchived AS T2
ON T1.client_name = T2.client_name
WHERE T2.client_name IS NULL;

If preferred, you may even be able to maintain this table in Excel and
create the JOIN across databases e.g.

SELECT T1.client_name
FROM
[MS Access;Database=C:\MyJetDB.mdb;].MyTable AS T1
LEFT JOIN
[Excel 8.0;HDR=YES;Database=C:\MyWorkbook.xls;].[ToBeArchived$] AS
T2
ON T1.client_name = T2.client_name
WHERE T2.client_name IS NULL;

Jamie.

--





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
Extract hyperlink string from excel cell Ryan Sapien Links and Linking in Excel 1 January 20th 05 12:24 AM
Query a Access database that has a module from Excel Oggie Excel Discussion (Misc queries) 1 January 4th 05 08:43 AM
New web query with Excel Pro Edition 2003 Chandler Links and Linking in Excel 2 December 15th 04 06:03 PM
How to use a Access Query that as a parameter into Excel database query Karen Middleton Excel Discussion (Misc queries) 1 December 13th 04 07:54 PM


All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"