dynamic database name in sql statement