0

I am querying a MSSQL DB with Perl using the DBD:ODBC module and FreeTDS.

The query response is returning successfully but backslash characters \ are removed from the response.

So for example Windows directories in the text of one of the fields returned that should read c:\some_dir\some_file are returning c:some_dirsome_file. Using iSQL or tSQL on the same linux box where I am running the query has the backslash characters present as expected.

Any idea on how to get it to not remove the backslashes or what might be causing it?

2 Answers2

0

Using this as a reference, it would seem that MSSQL reads the \ as forcing a newline. I would infer that when MSSQL attempts to return the string, it simply removes any whitespace.

Tsamaunk
  • 68
  • 1
  • 1
  • 6
0

Can you show us the isql output, the perl script and tell us the column type containing the dir path. It works fine for me here:

$ perl -MDBI -le '$h = DBI->connect("dbi:ODBC:baugi","xx","yy");eval {$h->do(q/drop table mje/)};$h->do(q/create table mje (a varchar(255))/);$h->do(q|insert into mje values(?)|, undef, q|c:\some_dir\some_file|); my $r = $h->selectall_arrayref(q/select * from mje/);use Data::Dumper;print Dumper($r);'
$VAR1 = [
          [
            'c:\\some_dir\\some_file'
          ]
        ];
bohica
  • 5,932
  • 3
  • 23
  • 28