in reply to Re^2: using dbi to run sql file
in thread using dbi to run sql file
As I said I have no experience of sqlcmd. However I've used DBD::ODBC for ages and know this fairly well. As I've not used sqlcmd I'm not sure what you are expecting as output in the output file. If your input file contains a number of SQL select statements and you want to see result-sets in the output file I'd need to know how you expect the output in the output file. Simplistically I'd say you open a DBI connection to your database, read a line at a time from your input file and feed it into DBI's prepare then execute and lastly (and this is where it is difficult to say) call something like fetchrow_arrayref and Data::Dumper the result into your output file.
If your problem is that each line in the input file selects a different result-set (i.e., different columns) then you'd need to say how you would like the results to look. Certainly I cannot guess this for you.
|
|---|