?
Solved

t-SQL SYNTAX question

Posted on 2011-10-20
5
Medium Priority
?
259 Views
Last Modified: 2012-05-12
Now II want to say I wrote it like this but it errors out.

select * from ORDER_PROC where ORDERING_DATE > '2010-09-01'

AND proc_code does not start with "LAB"
0
Comment
Question by:Becky Edwards
5 Comments
 
LVL 9

Expert Comment

by:snurker
ID: 37000125
What is the error?

There could be a number of reasons why this would fail.
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 37000158
Could be date format error - what about this query ? returns erro ?
select * from ORDER_PROC where ORDERING_DATE > '09/01/2010'

Open in new window



0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 37000165
select * from ORDER_PROC where ORDERING_DATE > '2010-09-01' AND proc_code not like 'LAB%'
 
0
 
LVL 23

Expert Comment

by:Rajkumar Gs
ID: 37000167
Also try this line on top, which can set your dateformat to month-day-year
SET DATEFORMAT MDY

Open in new window

0
 

Author Closing Comment

by:Becky Edwards
ID: 37000182
Worked great!  Thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question