Hi list, i have a simple query that doesn't execute properly. In config file: #sql named instance: SqlNamedInstance01 # MAC LIMIT update control { Tmp-Integer-1 = "%{SqlNamedInstance01: SELECT count(*) FROM mac_limit WHERE Username = '%{SQL-User-Name}' and callingstationid='%{Calling-Station-Id}'}" } if ("%{control:Tmp-Integer-1}" == 0) { update control { Tmp-String-1 = " MAC LIMIT: MAC address not authorized! " } reject } while in debug mode: (0) [SqlNamedInstance01] = ok (0) update control { (0) EXPAND %{%{Stripped-User-Name}:-%{%{User-Name}:-DEFAULT}} (0) --> igor.smitran (0) SQL-User-Name set to 'igor.smitran' rlm_sql (SqlNamedInstance01): Reserved connection (2) (0) Executing select query: SELECT count(*) FROM mac_limit WHERE Username = '' and callingstationid='44-d4-e0-a2-f3-48' rlm_sql (SqlBlicnetSsid): Released connection (2) (0) EXPAND %{SqlNamedInstance01: SELECT count(*) FROM mac_limit WHERE Username = '%{SQL-User-Name}' and callingstationid='%{Calling-Station-Id}'} (0) --> 0 (0) Tmp-Integer-1 = 0 (0) } # update control = noop (0) if ("%{control:Tmp-Integer-1}" == 0) { (0) if ("%{control:Tmp-Integer-1}" == 0) -> TRUE (0) if ("%{control:Tmp-Integer-1}" == 0) { So, for some reason, SQL-User-Name is empty. Any help anyone? Thank you, Igor