July 11, 2013 at 2:58 pm
I am rather new to working with databases and queries. That being said.....
I am trying to pull data in from an Oracle data base into an excel spread sheet. I already have the connections and everything, but I cant seem to figure out how to restrict the data to only that in the current month.
I know i need to add a "where" clause to my query, but I cant find the proper one to insert.
can someone help me out with this?
the field that this is bassed off of is a date time field.
July 11, 2013 at 3:11 pm
Something like
WHERE myDateField <= DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0)) -- last day of current month
AND myDateField => DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0) -- first day of current month
You could also use WHERE MONTH(myDateField) = MONTH(GETDATE()), but the previous one makes better use of indexes (if present on the myDateField column).
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 12, 2013 at 6:39 am
when i use these i get an error that says "Oralce ODBC Ora -00920 invlaid operational operator
July 12, 2013 at 6:42 am
I probably used some TSQL function which are not available in Oracle, so you might want to convert some functions to PLSQL.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 12, 2013 at 6:44 am
I will be honest.... I am a complete moron when it comes to this stuff.....
July 12, 2013 at 6:49 am
This should get you started:
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 12, 2013 at 7:48 am
This is not an Oracle forum...
It will be good if you post your query in proper forum
_______________________________________________________________
To get quick answer follow this link:
http://www.sqlservercentral.com/articles/Best+Practices/61537/
July 12, 2013 at 8:32 am
mromano222 (7/12/2013)
when i use these i get an error that says "Oralce ODBC Ora -00920 invlaid operational operator
You posted in a SQL server forum 🙂 He gave you a bunch of T-SQL (Transact) statements. I'd suggest moving this thread on over to the Oracle section so that you can get some traction on it. Or depending on what this is for install sql server express and use sql 😛
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply