我正在使用SQL Report Builder編寫報表。我必須使用以下語句從文本字段(customer_order_line_hist,field = message_text)導出兩個與日期相關的字段。如何將文本字段更改爲SQL Select Statement中的日期字段
原來MESSAGE_TEXT場總是與日期信息外相同:「計劃交貨日期已經從2013年6月28日00.00.00改爲2013年5月16日00.00.00」
我試圖將兩個輸出字段(FROM_DATE & TO_DATE)轉換爲日期時間字段或格式爲mm/dd/yyyy。
我嘗試了CONVERT和CAST函數,但沒有成功。有任何想法嗎?如果你的語法正確
Select SUBSTR(t.message_text, 49, 10) AS FROM_DATE,
SUBSTR(t.message_text, 72, 10) AS TO_DATE,
t.order_no,
t.line_no,
t.rel_no,
t.line_item_no,
t.history_no
FROM customer_order_line_hist t
Where t.message_text Like 'The planned delivery date%'
你正在使用哪些DBMS? SQL Server,MySQL等 – gvee