SQL script updated