in reply to Question about joins?

With respect, posting your SQL code isn't nearly as much help without posting your Perl code as well. I strongly suspect that DBI will be a better match for you, and I know it works -- I use DBI with DBD::ODBC to connect to SQL Server databases all the time.

Why don't you post some code that you tried with DBI, and we'll try to help you fix that up? Or, failing that, at least post the releveant Perl for this problem.

Anima Legato
.oO all things connect through the motion of the mind

Replies are listed 'Best First'.
Re^2: Question about joins?
by zackdade (Initiate) on Jan 14, 2005 at 16:58 UTC
    excellent :) thanks here is the code.
    $username="admin"; $pw="temppwd"; # connect to the named DSN, returns a database handle $dbh=new Win32::ODBC("DSN=APS;UID=$username;PWD=$pw;"); die "Unable to connect to DSN PerlSysAdm:" . Win32::ODBC::Error( ) . +"\n" unless (defined $dbh); $selst = "select APSVehicles.*, DlrLogins.* FROM APSVehicles INNER JOI +N DlrLogins ON APSVehicles.Dealer = DlrLogins.P1 or APSVehicles.Deale +r = DlrLogins.P2 WHERE DlrLogins.UserID = '$AuthUser' ORDER by DLRID" +; print "<BR>$selst<BR>\n"; $rc = $dbh->Sql($selst); die "Error: " . Win32::ODBC::Error( ) . "\n"; $results = $dbh->RowCount( ); $a = 1; $temp = 0; while ($dbh->FetchRow( )) { push(@AutoActive,$dbh->Data("AutoActive")); push(@Tag,$dbh->Data("Tag")); push(@Dealer,$dbh->Data("Dealer")); push(@YrMade,$dbh->Data("YrMade")); push(@Make,$dbh->Data("Make")); push(@Model,$dbh->Data("Model")); push(@ExtCol,$dbh->Data("ExtCol")); push(@Price,$dbh->Data("Price")); push(@DateAdded,$dbh->Data("DateAdded")); push(@FinanceAvail,$dbh->Data("FinanceAvail")); $a = ++$a; } $dbh->DropCursor( ); $dbh->Close( );
    Thanks - Zack
      I would reccomend an on the fly connect, in order to reduce dependence on the DSN being setup.
      my $dbh = DBI->connect('dbi:ODBC:driver=SQL Server;server=192.168.x.x; +database=My Database;app=my database application',$user,$pass);