Some SQL clients do provide the facility that allow you to create queries or data straight from files. However I believe the better approach would be to write a script for this.
Based on other questions you recently gave like this one then perhaps the solution below in Perl may help you:
use 5.012;
use warnings;
use SQL::Abstract;
my $sql = SQL::Abstract->new;
my @cols = qw/ idA idB stringValue /;
my $where = build_sql_where_from_file( 'list.txt', @cols[0,1] );
my ($query, @bind) = $sql->select(
'yourTable',
\@cols,
$where,
);
sub build_sql_where_from_file {
my $file = shift;
my @build;
open my $fh, '<', $file or die $!;
for my $line (<$fh>) {
chomp $line;
my @fields = split / /, $line;
push @build, {
-and => [
map { $_ => shift @fields } @_,
]
};
}
return \@build;
}
If I now do the following using your example list.txt
...
say $query;
say join ":", @bind;
then I get:
SELECT idA, idB, stringValue FROM yourTable WHERE ( ( ( idA = ? AND idB = ? ) OR ( idA = ? AND idB = ? ) OR ( idA = ? AND idB = ? ) ) )
xyz:2:abc:5:abc:6
Which is exactly what I need to then plugin straight into a DBI
query.
Hope that helps.
/I3az/