SQL - inserting yearmonth variable

Steven Staples sstaples at mnsi.net
Mon Dec 12 16:48:29 CET 2011


Good morning list..

I am trying to insert a YEAR and MONTH into my sql table.  I have in the
past, used a stored procedure for the accounting start/stop, which worked
well.

>From what I see, %S will give me a current timestamp, but how can I
get/extract the year and month from this?  Or is there an easier way to do
this... 

I tried adding:
 Yearmonth = $(date +%Y%m)
As a variable, and then putting it into the sql query like:
	accounting_start_query = "INSERT INTO ...<snip>'${Yearmonth}'
But that didn't work.

Could someone please help me with getting a year & month variable set?

THANKS!!!

Steve





More information about the Freeradius-Users mailing list