make sql checks like macro