SQL - inserting yearmonth variable

Alan DeKok aland at deployingradius.com
Mon Dec 12 18:06:39 CET 2011


Steven Staples wrote:
>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... 

  You should be able to use SQL functions to generate a date, or to
parse the date supplied by FreeRADIUS.

> I tried adding:
>  Yearmonth = $(date +%Y%m)

  I have no idea why you think that would work.

> As a variable, and then putting it into the sql query like:
> 	accounting_start_query = "INSERT INTO ...<snip>'${Yearmonth}'
> But that didn't work.

  See the FAQ for "it doesn't work".

  Alan DeKok.



More information about the Freeradius-Users mailing list