Deep Tech Fusion

tech related weblog

Transact-SQL – Operators

  1. + (Add):
    Adds two numbers. This addition arithmetic operator can also add a number, in days, to a date.

    SELECT c.FirstName, c.LastName, VacationHours, SickLeaveHours,
        VacationHours + SickLeaveHours AS 'Total Hours Away'
    FROM HumanResources.Employee AS e
        JOIN Person.Contact AS c ON e.ContactID = c.ContactID

Advertisements

December 28, 2006 Posted by | MSSQL | Leave a comment

Update Word document through PHP

$filename = “C:\\document_”.date(“YmdHis”).”.doc”;

$template = “C:\\template.htm”;

$fp_temp = fopen($template, “rb”);
$fp = fopen($filename, “wb”);

$old_contents = fread ( $fp_temp, filesize ($template));
fclose ( $fp_temp);
$new_constants = str_replace(“var_username”, “Deepak”, $old_contents);

$rset = “<table width=’100%’ ><tr><td>#</td><td >Name</td><td >Date of Join</td><td >Title</td><td >Dept</td></tr>”;
$rset .= “<tr><td>123</td><td>Deepak</td><td>Oct 10, 2003</td><td>Programmer</td><td>IT</td></tr>”;
$rset .= “<tr><td>123</td><td>Sachin</td><td>Oct 10, 2005</td><td>Developer</td><td>IT</td></tr>”;
$rset .= “<tr><td>123</td><td>Amita</td><td>Oct 10, 2006</td><td>System Admin</td><td>HR & Admin</td></tr>”;
$rset .= “<tr><td>123</td><td>Deepa</td><td>Oct 10, 2002</td><td>Hr Head</td><td>HR & Admin</td></tr>”;
$rset .= “<tr><td>123</td><td>Poja</td><td>Oct 10, 2003</td><td>Developer</td><td>IT</td></tr></table>”;
$constants = str_replace(“Var_record_sets”, $rset, $new_constants);

fwrite($fp, $constants) ;

December 28, 2006 Posted by | PHP | Leave a comment