working on converting to SQL Server