var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Updating Date in SQL Query (Excel Connections OLE DB Query)
I am running a query that returns transactions that were done at a given point.
For this, I am using the"connections" part of Excel.
I have created a workbook connection
Connection type : OLE DB Quert
Command Type: SQL
t.SP_ID AS Salesperson
,sum(CASE t.Transaction_Date WHEN '01/05/2012' THEN (abs(t.Transaction_Units) * t.Transaction_Price
It runs finds and returns my data into a table in Excel.
However, I need to manually update the relevant date in the Command Text.
Is there a way that the connection automatically updates the date. as indicated in a cell in Excel, or maybe t-1 given that the file updates automatically every time I open?
You can obtain today's date in SQL using the GetDate() function.
SELECT GetDate() As todays_date_and_time
, DateAdd(dd, DateDiff(dd, 0, GetDate()), 0) As todays_date_no_time
You should not be trying to update database date from Excel, anyway. Excel is acceptable for viewing data, but it is not appropriate as a user-interface for transaction processing.
Tags for this Thread