From: "David Evans" <dev...@monsoon.co.uk> > This is my Perl: > > *********Begin Perl Code********* > use DBIx::SQLEngine; > > $sqllist1 = "IF EXISTS (\nSELECT 1 FROM > INFORMATION_SCHEMA.ROUTINES\nWHERE ROUTINE_NAME = 'GetDriveSize'\nAND > ROUTINE_SCHEMA = 'dbo'\nAND ROUTINE_TYPE = 'FUNCTION'\n)\nBEGIN\nDROP > FUNCTION dbo.GetDriveSize\nEND\nGO";
AWWWWWW. First, you can put normal newlines into string literals in Perl and second you can use the "quote-like operators" (see perldoc perlop) or here-docs so that you do not have to keep on escaping quotes: $sqllist1 = qq{ IF EXISTS ( SELECT 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME = 'GetDriveSize' AND ROUTINE_SCHEMA = 'dbo' AND ROUTINE_TYPE = 'FUNCTION' ) BEGIN DROP FUNCTION dbo.GetDriveSize PRINT 'Dropped dbo.GetDriveSize' END GO }; or sqllist1 = <<'*END*'; IF EXISTS ( SELECT 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME = 'GetDriveSize' AND ROUTINE_SCHEMA = 'dbo' AND ROUTINE_TYPE = 'FUNCTION' ) BEGIN DROP FUNCTION dbo.GetDriveSize PRINT 'Dropped dbo.GetDriveSize' END GO *END* > )) { > print STDERR "Connected to $device_id database!\n"; > print STDERR "sql = $sql\n"; > my $fish1; > print STDERR "sqllist = $sqllist1\n"; > $fish1 = $dbhstr->prepare($sqllist1); > $fish1->execute(); > print STDERR "sqllist = $sqllist2\n"; > $fish2 = $dbhstr->prepare($sqllist2); > $fish2->execute(); > my $fish = $dbhstr->selectall_array($sqllist3); > print STDERR "Free Gb = $fish\n" > } > ... And the error you received was ... ? Jenda ===== je...@krynicky.cz === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs