t-SQL SYNTAX question

Posted on 2011-10-20
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"
Question by:Becky Edwards
    LVL 9

    Expert Comment

    What is the error?

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

    Expert Comment

    by:Rajkumar Gs
    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

    LVL 69

    Accepted Solution

    select * from ORDER_PROC where ORDERING_DATE > '2010-09-01' AND proc_code not like 'LAB%'
    LVL 23

    Expert Comment

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

    Open in new window


    Author Closing Comment

    by:Becky Edwards
    Worked great!  Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
    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.

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now