p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Access and Access VBA > Access
I forgot my password Register Now
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old March 15th, 2007, 07:44 AM
Friend of Wrox
Points: 9,516, Level: 42
Points: 9,516, Level: 42 Points: 9,516, Level: 42 Points: 9,516, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old March 19th, 2007, 05: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]%’'


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old March 20th, 2007, 07:55 AM
Friend of Wrox
Points: 9,516, Level: 42
Points: 9,516, Level: 42 Points: 9,516, Level: 42 Points: 9,516, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old March 20th, 2007, 09: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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old March 20th, 2007, 09:16 AM
Wrox Author
Points: 12,827, Level: 49
Points: 12,827, Level: 49 Points: 12,827, Level: 49 Points: 12,827, Level: 49
Activity: 15%
Activity: 15% Activity: 15% Activity: 15%
 
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,029
Thanks: 1
Thanked 42 Times in 42 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
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old March 28th, 2007, 01: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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
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

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

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 04:10 AM
Calling a Function within an MS SQL Statement flyin BOOK: Professional SQL Server 2000 Programming 0 September 4th, 2003 04:36 PM



All times are GMT -4. The time now is 07:02 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc