I am writting a script to auto input info into a SQL 2k DB Table and in it I need to do a check to make sure an SQL statment can be ran is there a way to do this in either TSQL or PERL? This is the code (I even formated it):#!user/local/bin/perl -wuse strict;use DBI;use GD;my ($myobject, $srcimage, $base_path, @games, $game, @subsets,$subset, $game_name, $subset_name, @images, $image, $width, $height, $alt,$dbh, $sth, $number, @resultholder, $resultholder);$base_path = "f:/FFimages/Compleated";$alt = 'None';opendir (BASEDIR, "$base_path") or die "Error opening $base_path";@games = grep {-d "$base_path/$_" && !/\./} readdir(BASEDIR);closedir (BASEDIR);foreach $game (@games){ $game_name = $game; opendir (GAMEDIR, "$base_path/$game"); @subsets = grep {-d "$base_path/$game/$_" && !/\./} readdir (GAMEDIR); #Error Line foreach $subset (@subsets){ $subset_name = $subset; opendir (SUBSETDIR, "$base_path/$game/$subset"); @images = grep {/\.jpg/} readdir (SUBSETDIR); foreach $image (@images){ $myobject = "$base_path/$game/$subset/$image"; $srcimage = GD::Image -> newFromJpeg($myobject); if ($srcimage) { ($width, $height) = $srcimage -> getBounds();} $dbh = DBI -> connect ('dbi:ODBC:read', 'UID', 'PASS') or die "Could not connect to DB"; $sth = $dbh -> prepare (qq~select ImageNumber from images where SubSet = "$subset_name" order by ImageNumber desc~); $sth -> execute (); @resultholder = $sth -> fetchrow_array; if ($resultholder[0]) { $number = $resultholder[0]; } else { $number = 0; } print $number; $sth = $dbh -> prepare (qq~insert into images (Game, SubSet, Image, Width, Height, AltText, ImageNumber) values ('$game_name', '$subset_name', '$image', $width, $height, '$alt', $number)~); $sth -> execute(); $dbh -> disconnect();}}}
The statment I want to check is the select statment.-- If I get used to enving others...Those things about my self I pride will slowly fade away.-Stellvia