Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 9th, 2007, 04:07 PM
Friend of Wrox
 
Join Date: Sep 2005
Location: , , USA.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Corey
Default convert a SQL Statement from MS Access to a SQL

Hi everyone.

I'm trying to convert a SQL Statement from MS Access to a standard SQL statement.

Could anyone help me understand how I do this?

HAVING (((EMTADMIN_DR_MESSAGE.MDATE) Between #1/1/2006# And Date()-1) AND ((EMTADMIN_DR_MESSAGE.MESSAGE_NOTES) Like "PID #######" Or (EMTADMIN_DR_MESSAGE.MESSAGE_NOTES) Like "Program ID -*#######" Or (EMTADMIN_DR_MESSAGE.MESSAGE_NOTES) Like "*#######*")


Any Help Is greatly appreciated

Corey

Reply With Quote
  #2 (permalink)  
Old March 15th, 2007, 06:44 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Where is the rest of the statement?

Dim dtDate As Date

dtDate = Date()-1

HAVING [EMTADMIN_DR_MESSAGE.MDATE] Between #1/1/2006# And " & dtDate & " AND [EMTADMIN_DR_MESSAGE.MESSAGE_NOTES] Like 'PID #######' Or [EMTADMIN_DR_MESSAGE.MESSAGE_NOTES] Like 'Program ID -%#######' Or [EMTADMIN_DR_MESSAGE.MESSAGE_NOTES] Like '%#######%'

I am not sure about the # wildcards you are using. ## means date.

Did that help any? Do you have SQL Query Analyzer to try this out on your SQL database?




mmcdonal
Reply With Quote
  #3 (permalink)  
Old March 19th, 2007, 04:09 PM
Friend of Wrox
 
Join Date: Sep 2005
Location: , , USA.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Corey
Default

Hi Again, can anyone help me identify why I'm getting zero records returned, when I know I should be getting over 10,000 records

SELECT *
FROM emtadmin_BD.NESSAGE
where(NESSAGE_NOTES) Like '%[0-9][0-9][0-9][0-9][0-9][0-9][0-9]%’'


Reply With Quote
  #4 (permalink)  
Old March 20th, 2007, 06:55 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

What do these refer to? [0-9][0-9][0-9][0-9][0-9][0-9][0-9]


mmcdonal
Reply With Quote
  #5 (permalink)  
Old March 20th, 2007, 08:09 AM
Friend of Wrox
 
Join Date: Sep 2005
Location: , , USA.
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to Corey
Default

That is can be any number 0 through 9

Reply With Quote
  #6 (permalink)  
Old March 20th, 2007, 08:16 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Your trying to evaluate a regular expression in a like statement? Unfortunately, you are evaluating a string literal here so your statement is looking for a field that is similar to: [0-9][0-9][0-9][0-9][0-9][0-9][0-9]that is why your query returns 0 results.

You can evaluate Regular expressions from the Master stored procedures as to whether or not the given input matches the given expression, however, I don't know about searching a field based upon an expression.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
Reply With Quote
  #7 (permalink)  
Old March 28th, 2007, 12:33 PM
Registered User
 
Join Date: Nov 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe I'm over-simplifying but wouldn't you want:

SELECT *
FROM emtadmin_BD.NESSAGE
where(NESSAGE_NOTES) Like '%#######%’'

the hash mark is a wild card for numeric data only.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
I am trying to convert a MS Access Query to a SQL? WebLadyBug SQL Server ASP 3 March 9th, 2007 12:39 PM
Convert SQL to MS Access Corey Access 1 February 2nd, 2007 11:46 AM
how to convert ms access db to sql server method SQL Server 2000 1 March 11th, 2005 11:44 PM
Calling a Function within an MS SQL Statement flyin Classic ASP Databases 3 September 5th, 2003 03:10 AM



All times are GMT -4. The time now is 11:13 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.