Long SQL queries in attributes