Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Thank you for your input, it is appreciated.

with Win32::ODBC, I am able to execute stored procedures and basic queries routinely. It wasn't until I had the need to run a prebuilt script file, where the problem arose.

after much research tonight, it appears that this module isn't built to handle it and it was suggested to use DBI and DBD:ODBC, as you have.

I did some testing tonight using the DBI DBD:ODBC combination in which I read the file in and prepare each line in my loop and then at file end issue the execute.

This produces errors on the prepare, "incorrect syntax near...", I then tried to execute each line after the prepare and still get similar errors.

I know the sql script is solid and working. I can run it from the management console of osql/sqlcmd without problems. I must be ordering something incorrectly, not sure. I have a good understanding of the both modules, but am better with Win32::ODBC, but it seems simple enough to pick up with the DBI

I looked for tests on Win32::ODBC, but didn't find anything in addition to the perdoc and info on CPAN.

The SQL script looks like this:

use db

set nocount on

declare @MRN varchar(255)

set @MRN = 'xxxxxxxx'


select distinct id as patientid, firstname, lastname

from person P join patient_iorg PI on id = personid

where OrganizationMRN = @MRN;

The error is either on the from or the where depending on where I position the execute statement..

In reply to Re^2: pass MS SQL server scripts into Win32::ODBC by Anonymous Monk
in thread pass MS SQL server scripts into Win32::ODBC by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    [LanX]: ... obviously too long
    [Eily]: I yes, the natural onion in the flamming eye, I know what you mean
    [LanX]: Eily your turn to provide a pic :)
    [Eily]: occupe toi de tes oignons
    LanX could do a zoom out in animated gif ...
    [LanX]: heh
    [marto]: get with the times, webm :P
    [LanX]: didn't know this expression xD
    [Eily]: :)
    [Eily]: if you want to learn French expressions you can give a look to @bouletcorp on twitter

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (10)
    As of 2017-12-14 16:26 GMT
    Find Nodes?
      Voting Booth?
      What programming language do you hate the most?

      Results (398 votes). Check out past polls.