Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
------------------------------------------------------
11-1-2007 -- The DELETE line is where the problem lies. Here is the code:

use DBI;

$dbh = DBI->connect('dbi:ODBC:Tradchem2005');
#--select * from xcontacts
$sql1 =
"UPDATE xcontacts
SET NEWCOLUMN8 = 'X'
where sysparentid in (select sysrowid from clients where loaddate >= (GETDATE()-7)) and contactname <> '' ";

#--XCONTACT TO CONTACTS
$sql2 = "delete from contacts where sysrowid in (select sysrowid from Xcontacts where newcolumn8 = 'X') ";

$sql2a = "
Insert Contacts Select Address4, AddInterests, Child1Birthday, Child1info, Child1Name, Child2Birthday, Child2Info, Child2Name,
SysRowID, SysRoute, SysParentID, SysDateAdded, SysDateUpdated, Address1, Address2, Address3, CallWhen, City, ColComment,
CustomerName, ContactName, Country, county, Division, EmailAddress, Ext1, Ext2, GoalofCall, HotButton, LastCalled, Leadstatus,
Birthday, PersonalData, PersonalIntr, ZipCode, ReportsTo, Salutation, Specialty, State, Phone1, Phone2, FAXnumber, Title, TypeUpdate,
cellPhone, Pager, SysParentTable, ReportsToID, Child3Birthday, Child3Info, Child3Name, Department, Hobbies, MoveDate, MoveTo,
NewColumn1, NewColumn2, NewColumn3, NewColumn4, NewColumn5, NewColumn6, NewColumn7, NewColumn8, OrphanContact,
Spouse, Spousebd, SpouseInfo, WedAnniv, QBType, PhoneType, ContactIDnumber, ContactNumber, ContactPurpose, CountryPhoneCode,
FirstName, LastName, YearStarted, CorpID, ContactNameOldSys

from Xcontacts where newcolumn8 = 'X'";

$sql3 = "
UPDATE Xcontacts
SET NEWCOLUMN8 = NULL
WHERE NEWCOLUMN8 = 'X' ";

$sql4 = "
UPDATE contacts
SET NEWCOLUMN8 = NULL
WHERE NEWCOLUMN8 = 'X' ";

$getinfo = $dbh->prepare($sql1);
$getinfo->execute();
$rcount1 = $getinfo->rows;
print OUTFILE ("SQL1 execute finished -- $rcount1 \n");

$getinfo = $dbh->prepare($sql2);
$getinfo->execute();
$rcount2 = $getinfo->rows;
print OUTFILE ("SQL2 execute finished -- $rcount2\n");

$getinfo = $dbh->prepare($sql2a);
$getinfo->execute();
$rcount2a = $getinfo->rows;
print OUTFILE ("SQL2a execute finished -- $rcount2a\n");

$getinfo = $dbh->prepare($sql3);
$getinfo->execute();
$rcount3 = $getinfo->rows;
print OUTFILE ("SQL3 execute finished -- $rcount3\n");

$getinfo = $dbh->prepare($sql4);
$getinfo->execute();
$rcount4 = $getinfo->rows;
print OUTFILE ("SQL4 execute finished -- $rcount4\n");

$dbh->disconnect;
close (OUTFILE);

In reply to Re^2: DBI on windows problem by txtoolman
in thread DBI on windows problem by txtoolman

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-19 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found