> I'm using the Win32::SqlServer module to execute queries against my
> database.
>
> Normally a query might look like:
>
> our $mySQL = SQLfunctions->new;
> $mySQL->createSQLConnection("localhost\\Company", "Import");
>
> @results = $mySQL->runQuery("Select A,B from tablename;");
>
> foreach my $rows (@results)
> {
> print $$rows{A}."\n";
> print $$rows{B}."\n";
> }
>
> All values from columns A and B will be printed.
>
> But now I want to use a query that will show me the difference between
> two tables, Table1 and Table2. This query is:
>
> select 'table1' as tblName, * from
> (select * from table1
> except
> select * from table2) x
> union all
> select 'table2' as tblName, * from
> (select * from table2
> except select *
> from table1) x
>
> Based on the return from this query, any of the columns in the table
> could be represented. How do I determine which keys are present so I
> can view the results?
Assumimg that what's returned is an Array of Hashes (AoH) can't you
just cycle through the keys with a foreach and the keys function?
e.g. from perldsc:
# print the whole thing one at a time
for $i ( 0 .. $#AoH ) {
for $role ( keys %{ $AoH[$i] } ) {
print "elt $i $role is $AoH[$i]{$role}\n";
}
}
Just in
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs