|
|
 |
| 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.
|
 |

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
|
|
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
|

March 15th, 2007, 07:44 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
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
|

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
|
|
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]%’'
|

March 20th, 2007, 07:55 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
What do these refer to? [0-9][0-9][0-9][0-9][0-9][0-9][0-9]
mmcdonal
|

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
|
|
That is can be any number 0 through 9
|

March 20th, 2007, 09:16 AM
|
|
Wrox Author
Points: 12,827, Level: 49 |
|
|
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,029
Thanks: 1
Thanked 42 Times in 42 Posts
|
|
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
================================================== =========
|

March 28th, 2007, 01:33 PM
|
|
Registered User
|
|
Join Date: Nov 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |