Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
im triyn to retrieve data to excel with the microsoft query
can you help me with the function to get the day i run the query? get day() doesnt work. a query error appears! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
Try this in your SQL code:
Date() as RunDate Does that help? *********** Regards, Ron "ivan" wrote: im triyn to retrieve data to excel with the microsoft query can you help me with the function to get the day i run the query? get day() doesnt work. a query error appears! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
Thanks ron, but doesnt work, it says that cant show that query graphically
"Ron Coderre" wrote: Try this in your SQL code: Date() as RunDate Does that help? *********** Regards, Ron "ivan" wrote: im triyn to retrieve data to excel with the microsoft query can you help me with the function to get the day i run the query? get day() doesnt work. a query error appears! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
Ivan
Nothing's really wrong. That's just a notice from MS Query that it can't represent the RunDate field in a table so it can't show you the query graphically. From that point on, you'll need to edit the query via the SQL window. Does that help? *********** Regards, Ron "ivan" wrote: Thanks ron, but doesnt work, it says that cant show that query graphically "Ron Coderre" wrote: Try this in your SQL code: Date() as RunDate Does that help? *********** Regards, Ron "ivan" wrote: im triyn to retrieve data to excel with the microsoft query can you help me with the function to get the day i run the query? get day() doesnt work. a query error appears! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
i've tried but didnt work, i've tried with getday,now,etc
thanks a lot for your help "Ron Coderre" wrote: Ivan Nothing's really wrong. That's just a notice from MS Query that it can't represent the RunDate field in a table so it can't show you the query graphically. From that point on, you'll need to edit the query via the SQL window. Does that help? *********** Regards, Ron "ivan" wrote: Thanks ron, but doesnt work, it says that cant show that query graphically "Ron Coderre" wrote: Try this in your SQL code: Date() as RunDate Does that help? *********** Regards, Ron "ivan" wrote: im triyn to retrieve data to excel with the microsoft query can you help me with the function to get the day i run the query? get day() doesnt work. a query error appears! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
Perhaps if you posted a little more of your SQL code and told us what kind of
database (Oracle, MS Access, SQLServer, etc) you're accessing, we'd have a better chance of helping. *********** Regards, Ron "ivan" wrote: i've tried but didnt work, i've tried with getday,now,etc thanks a lot for your help "Ron Coderre" wrote: Ivan Nothing's really wrong. That's just a notice from MS Query that it can't represent the RunDate field in a table so it can't show you the query graphically. From that point on, you'll need to edit the query via the SQL window. Does that help? *********** Regards, Ron "ivan" wrote: Thanks ron, but doesnt work, it says that cant show that query graphically "Ron Coderre" wrote: Try this in your SQL code: Date() as RunDate Does that help? *********** Regards, Ron "ivan" wrote: im triyn to retrieve data to excel with the microsoft query can you help me with the function to get the day i run the query? get day() doesnt work. a query error appears! |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
this is the code
SELECT HelpDesk.Apellido, HelpDesk.Nombre, HelpDesk.Numero_de_Incidente, HelpDesk.Fecha_de_Creacion, HelpDesk.Creado_por, HelpDesk.Assigned_to, HelpDesk.Tipo_de_Problema, HelpDesk.Elem__Afectado, HelpDesk.Intervención FROM HelpDesk HelpDesk WHERE (HelpDesk.Fecha_de_Creacion={ts '2005-11-25 00:00:00'} And HelpDesk.Fecha_de_Creacion<={ts '2005-11-26 00:00:00'}) AND (HelpDesk.Estado<'Closed') AND (HelpDesk.Intervención<'Tarea Planificada') AND (HelpDesk.Edificio<'Planta Chile') ORDER BY HelpDesk.Apellido i need to get the day i run the query. can you help me? Thanks a lot. "Ron Coderre" wrote: Perhaps if you posted a little more of your SQL code and told us what kind of database (Oracle, MS Access, SQLServer, etc) you're accessing, we'd have a better chance of helping. *********** Regards, Ron "ivan" wrote: i've tried but didnt work, i've tried with getday,now,etc thanks a lot for your help "Ron Coderre" wrote: Ivan Nothing's really wrong. That's just a notice from MS Query that it can't represent the RunDate field in a table so it can't show you the query graphically. From that point on, you'll need to edit the query via the SQL window. Does that help? *********** Regards, Ron "ivan" wrote: Thanks ron, but doesnt work, it says that cant show that query graphically "Ron Coderre" wrote: Try this in your SQL code: Date() as RunDate Does that help? *********** Regards, Ron "ivan" wrote: im triyn to retrieve data to excel with the microsoft query can you help me with the function to get the day i run the query? get day() doesnt work. a query error appears! |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
There are 2 ways to solve this:
create a new column in your select clause that gives the current day/time. The function to do this depends on the DBMS. e.g. for SQL server this is "getdate()" so "Select getdate() as CurrentDate, ...... from ...." would work on SQL Server. If your query gives more that 1 record you will see the date for each line (maybe not want you want). With VBA it would look something like this: In Thisworkbook module: Dim Withevents qtb as QueryTable Sub Workbook_Open Set qtb = Thisworkbook.Sheets("Mysheet").QueryTables("Mytabl e") End Sub qtb_AfterRefresh(bSuccess as boolean) if bSuccess then Range("Mysheet!A1") = Now() End Sub This code would update A1 with current date after a succesful refresh. DM Unseen |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
Thanks for the info, the problem is i am working with remedy.
There i can use $date$ to replace the day but doesnt work in the microsoft query "DM Unseen" wrote: There are 2 ways to solve this: create a new column in your select clause that gives the current day/time. The function to do this depends on the DBMS. e.g. for SQL server this is "getdate()" so "Select getdate() as CurrentDate, ...... from ...." would work on SQL Server. If your query gives more that 1 record you will see the date for each line (maybe not want you want). With VBA it would look something like this: In Thisworkbook module: Dim Withevents qtb as QueryTable Sub Workbook_Open Set qtb = Thisworkbook.Sheets("Mysheet").QueryTables("Mytabl e") End Sub qtb_AfterRefresh(bSuccess as boolean) if bSuccess then Range("Mysheet!A1") = Now() End Sub This code would update A1 with current date after a succesful refresh. DM Unseen |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
sql query in excel
Is the $date$ function available through ODBC drivers? if so this might
be an issue with MSQuery. Maybe edit your query directly through VBA or another tool? I not, use the VBA solution. Dm Unseen |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2007 / MS Query - editing existing query to another sheet | Excel Discussion (Misc queries) | |||
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? | Excel Discussion (Misc queries) | |||
Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook? | Excel Discussion (Misc queries) | |||
Edit Query from Excel will not open query in MSQuery | Excel Programming | |||
How to use a Access Query that as a parameter into Excel database query | Excel Discussion (Misc queries) |