All of the DBI things like $sth->fetchrow_hashref etc. should work identically with the possible exception of the case of the column names (I forget if there is a difference, but if there is, it can be solved by using the FetchHashKeyName attribute).

As another poster mentioned, there will be some differences in datatypes. I don't know if MS-SQL supports MySQL extensions like the LIMIT clause. In terms of checking for these kinds of differences, I would recommend O'Reilly's _SQL_In_A_Nutshell_ - it's not the best SQL reference, but it does list implementation-specific differences for most commands. You could also try looking at some of the DBI extension modules that work on multiple databases and either use them or look at their code to see trouble spots. I've not used it but Rosetta claims to handle implementation differences. SQL::Translator ought to be useful for converting CREATE statements.

In terms of testing, you can comment out all of your executes and just run the prepares of all your SQL - the prepare will let you know if there are SQL syntax errors without actually doing anything to the database. Better yet, create a dummy database and just run your script and see where problems (if any) crop up.


In reply to Re: Re: CGI MySQL script to ASP(perlscript) MSSQL by jZed
in thread CGI MySQL script to ASP(perlscript) MSSQL by cosmicperl

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.