use Win32::ODBC; use Win32::OLE; $DSN = "dsn=CRRLIVE;uid=$UserID;pwd=$Password"; if (!($db = new Win32::ODBC($DSN))){ print "Error connecting to $DSN\n"; print "Error: " . Win32::ODBC::Error() . "\n"; exit; } $SqlStatement = <= '1 jan 2008' and [User] like '%SYS%' declare @CntCurrentDealSize int, @CntCurrentStatic int, @CntCurrentTrade int, @CntErrorTrade int, @CntFirstLegalEntity int, @CntGroupReport int, @CntImportBedrockData int, --- More code ENDSQL