how to convert this Oracle sql statement to that of MS SQL

i'm not very versed on SQL server...can someone help me convert the sql statement below to something that MS SQL server would understand? right now im using Oracle.....

select my_table.*, my_doc_search.doc_type from my_table, my_doc_search where my_table.idx_id=my_doc_search.doc_id and (( TRUNC(my_table.invoice_date,'DD') <> TO_DATE('2008-01-28','YYYY-MM-DD') ) ) order by my_doc_search.doc_type

thanks in advance...
LVL 1
ayeenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JimFiveCommented:
It looks like the only thing you need to changes is:
(( TRUNC(my_table.invoice_date,'DD') <> TO_DATE('2008-01-28','YYYY-MM-DD') ) )

I assume that TRUNC is removing the time from a datetime field, and To_Date is converting a char to a date, both of these can be done using convert, easiest is probably.

CONVERT(varchar(10), my_table.invoice_Date, 112) <> '20080128'
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ayeenAuthor Commented:
hi JimFive thanks for replying....

may i know what the "112" is for?

thanks!
0
JimFiveCommented:
112 indicates the date format of yyyymmdd
anything over 100 indicates to include the century. The remaining numbers indicate which date format to use. If you have SQL Server Books online installed you can look up CONVERT to get the list of codes.

I used 112 because it is the ISO standard format and there doesn't seem to be a code for yyyy-mm-dd that doesn't include the time.
--
JimFive
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.