I have many MS Sql queries in a hash that I am looping on. What I think I need to do is to be able to use quote like operators in the hash value. Here is a sample hash,
'Calls Received'=>"SELECT COUNT(DISTINCT sessionID ) FROM AgentConnect +ionDetail WHERE startDateTime BETWEEN '$yesterday' AND '$today'"

The $yesterday and $today variables are filled in correctly with a datetime format.
When I loop on the hash, and execute the value as a sql query, the return I get is either a 1 or a 0. Even when I had the sql queries in an array, the return was almost always a 1 or a 0 and not the correct sql query response. I do know that the actual query is correct. I tried doing,
'Calls Received'=>qq{"SELECT COUNT(DISTINCT sessionID ) FROM AgentConn +ectionDetail WHERE startDateTime BETWEEN '$yesterday' AND '$today'"}

but that didn't seem to work either. I got the error,
DBD::ODBC::db prepare failed: [FreeTDS][SQL Server]Statement(s) could +not be prepared. (SQL-42000) [FreeTDS][SQL Server]The identifier that starts with 'SELECT COUNT(DIS +TINCT sessionID ) FROM AgentConnectionDetail WHERE startDateTime BETW +EEN '2009-01-04 15:41:51.000' AND '2009-01-' is too long. Maximum len +gth is 128. (SQL-42000) at ./voip.pl line 75. Can't call method "execute" on an undefined value at ./voip.pl line 76 +.
Any ideas?

In reply to Quote-like operators in a hash by tux402

Title:
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, details, 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, summary, 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.