Sql script for AIS