Problem on DATEDIFF statement

I'm trying to use a DATEDIFF statement so I only see data from the last 7
days
How would I write that if I don't have a time stamp in a table to
reference?
If I could reference something I know I could do
Where
DATEDIFF (dd, example.tabletime, getdate ()) < 7
I need to do it
without referencing a value in a table and not sure how

If you're using SQL 2008 and up:
select * from myTable 
where DateColumn >= CAST(dateadd(day, - 7, CURRENT_TIMESTAMP) AS DATE)
AND DateColumn < CAST(dateadd(day, 1, CURRENT_TIMESTAMP) AS DATE) -- this will return all rows with dates within last 7 dates
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles

Similar Messages

  • Problem with READ Statement in the field routine of the Transformation

    Hi,
    I have problem with read statement with binary search in the field routine of the transformation.
    read statement is working well when i was checked in the debugging mode, it's not working properly for the bulk load in the background. below are the steps i have implemented in my requirement.
    1. I selected the record from the lookuo DSO into one internal table for all entried in source_packeage.
    2.i have read same internal table in the field routine for each source_package entry and i am setting the flag for that field .
    Code in the start routine
    select source accno end_dt acctp from zcam_o11
    into table it_zcam
    for all entries in source_package
    where source = source_package-source
         and accno = source_package-accno.
    if sy-subrc = 0.
    delete it_zcam where acctp <> 3.
    delete it_zcam where end_dt initial.
    sort it_zcam by surce accno.
    endif.
    field routine code:
    read table it_zcam with key source = source_package-source
                                                 accno  = source_package-accno
                                                 binary search
                                                 transportin no fields.
    if sy-subrc = 0.
    RESULT  = 'Y'.
    else.
    RESULT = 'N'.
    endif.
    this piece of code exist in the other model there its working fine.when comes to my code it's not working properly, but when i debug the transformation it's working fine for those accno.
    the problem is when i do full load the code is not working properly and populating the wrong value in the RESULT field.
    this field i am using in the report filter.
    please let me know if anybody has the soluton or reason for this strage behaviour.
    thanks,
    Rahim.

    i suppose the below is not the actual code. active table of dso would be /bic/azcam_o1100...
    1. is the key of zcam_o11 source and accno ?
    2. you need to get the sortout of if endif (see code below)
    select source accno end_dt acctp from zcam_o11
    into table it_zcam
    for all entries in source_package
    where source = source_package-source
    and accno = source_package-accno.
    if sy-subrc = 0.
    delete it_zcam where acctp 3.
    delete it_zcam where end_dt initial.
    endif.
    sort it_zcam by surce accno.
    field routine code:
    read table it_zcam with key source = source_package-source
    accno = source_package-accno
    binary search
    transportin no fields.
    if sy-subrc = 0.
    RESULT = 'Y'.
    else.
    RESULT = 'N'.
    endif.

  • Problem in Update Statement

    I got some problem in update statement.Can anybody discuss with me regarding my problem? Below is the occured problem.
    //all the declaration like Connection, ResultSet are declared, setting the ODBC path and so on steps have been set up before this method. When compile it, no error, when I start to run my program, the program�s interface is shown, but the following error was appearred and data cannot be updated, can anybody tell me where is my mistake?
    //ERROR:SQL Error in update statement:java.sql.SQLException [Microsoft][ODBC][ODBC Microsoft Access Driver] Syntax Error in UPDATE statement.
    //emp_overview is the table name
    // last_name, first_name, office_phone�.is the attributes of the table
    //this method had declare in the interface class already
    public String updateData (String idd, String ln, String fn, String op,
                   String oe, String hp, String ps, String ss)
                   throws java.rmi.RemoteException
         {//begin of this method
              String result ="";
              try
              Statement statement = connection.createStatement();
              String sql = "UPDATE emp_overview SET" +
              "last_name=' "+ln+
              " ', first_name=' "+fn+
              " ', office_phone=' "+op+
              " ', office_ext=' "+oe+
              " ', home_phone=' "+hp+
              " ', primary_skill=' "+ps+
              " ', secondary_skill=' "+ss+
              " ' WHERE id="+idd;
              statement.executeUpdate(sql);
              statement.close();
              catch (java.sql.SQLException e)
         System.out.println("SQL Error in update statement: "+e);
              //throw a RemoteException with the exception
              //embedded for the client to receive
         throw new java.rmi.RemoteException("Error in Updating exist row into DB", e);
              return result;
         }//end of this method

    Hi Kevin,
    According to the code you have posted, it looks like you are missing a space between "SET" and "last_name". I suggest you add the following line of code:
    System.out.println(sql);
    before the invocation of "executeUpdate()".
    I also suggest you add the following line of code:
    e.printStackTrace();in your "catch" block.
    Hope this helps.
    Good Luck,
    Avi.

  • Problem in Update statement using Execute Immediate

    Hi All,
    I am facing problem in update statement.
    I am creating dynamic sql and use "execute immediate" statement to execute a update statement.
    But it is not updating any thing there in the table.
    I have created a query like :
    update_query='Update '|| Table_Name ||' t set t.process_status =''Y'' where t.tid=:A';
    Execute immediate update_query using V_Id;
    commit;
    But it is not updating the table.
    I have a question , is execute immediate only does insert and delete?
    Thanks
    Ashok

    SQL> select * from t;
                     TID P
                     101 N
    SQL> declare
      2     V_Id          number := 101;
      3     Table_Name    varchar2(30) := 'T';
      4     update_query  varchar2(1000);
      5  begin
      6     update_query := 'Update '|| Table_Name ||' t set t.process_status =''Y'' where t.tid=:A';
      7     Execute immediate update_query using V_Id;
      8     commit;
      9  end;
    10  /
    PL/SQL procedure successfully completed.
    SQL> select * from t;
                     TID P
                     101 Y                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problem in UPDATE statement In Multiple Record Block

    Hi Friends,
    I have problem in update Statement for updating the record in multiple record data Block.
    I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
    I am inserting the fields like category,and post_no for partiular job in single data block
    Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
    There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
    then its updating all the record.
    my code is Bellow,
    IF v_count 0 THEN
    LOOP
    IF :SYSTEM.last_record 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
    VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
    :POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    next_record;
    ELSIF :SYSTEM.last_record = 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
    VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
    :POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    EXIT;
    END IF;
    END LOOP;
    SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
    v_button_no := SHOW_ALERT('user_alert');
    FORMS_DDL('COMMIT');
    CLEAR_FORM(no_validate);
    Please Guide me
    Thanks in advence

    As you do a loop over all the records in the block, of course every record is updated.
    Also, what you do is not the way is intended to be used. In general, you base a block on a table,then there is no need at all for writing INSERT's or UPDATE's. Forms also know's then, which records to be updated and which not.

  • Problem In Update Statement In Multiple Record Data Block

    Hi Friends,
    I have problem in update Statement for updating the record in multiple record data Block.
    I have two data Block the master block is single Record block and the 2nd data block is Multiple Record data Block.
    I am inserting the fields like category,and post_no for partiular job in single data block
    Now in second Multiple Record Data Block,i am inserting the multiple record for above fileds like no. of employees work in the position
    There is no problem in INSERT Statement as it is inerting all record But whenever i want to update particular Record (in Multiple Block) of employee for that category and Post_no
    then its updating all the record.
    my code is Bellow,
    IF v_count <> 0 THEN
    LOOP
    IF :SYSTEM.last_record <> 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
    VALUES(g_post_no, g_roster_no, g_category, :POST_HISTORY_MULTIPLE.idcode, :POST_HISTORY_MULTIPLE.joining_post_dt,
    :POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    next_record;
    ELSIF :SYSTEM.last_record = 'TRUE' THEN
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    IF SQL%NOTFOUND THEN
    INSERT INTO post_history(post_no,roster_no,category,idcode,joining_post_dt,leaving_post_dt,entry_gp_stage)
         VALUES (g_post_no,g_roster_no,g_category,:POST_HISTORY_MULTIPLE.idcode,
              :POST_HISTORY_MULTIPLE.joining_post_dt,:POST_HISTORY_MULTIPLE.leaving_post_dt,:POST_HISTORY_MULTIPLE.entry_gp_stage);
    END IF;
    EXIT;
    END IF;
    END LOOP;
    SET_ALERT_PROPERTY('user_alert',ALERT_MESSAGE_TEXT, 'Record Updated successfuly' );
    v_button_no := SHOW_ALERT('user_alert');
    FORMS_DDL('COMMIT');
    CLEAR_FORM(no_validate);
    Please Guide me
    Thanks in advence

    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;
    UPDATE post_history
    SET idcode = :POST_HISTORY_MULTIPLE.idcode,
    joining_post_dt = :POST_HISTORY_MULTIPLE.joining_post_dt,
    leaving_post_dt = :POST_HISTORY_MULTIPLE.leaving_post_dt,
    entry_gp_stage = :POST_HISTORY_MULTIPLE.entry_gp_stage
    WHERE post_no = :POST_HISTORY_SINGLE.post_no
    AND category = :POST_HISTORY_SINGLE.category
    AND roster_no = :POST_HISTORY_SINGLE.roster_no;
    AND idcode = :POST_HISTORY_MULTIPLE.idcode;These update statements are without where clause, so it will update all records.
    If it is specific to oracle forms then u may get better help at Forms section.

  • Problem with Decode statement

    Hi
    I am trying to achieve the following in my report:
    If an employee has a surname of . (dot) or a first name of . (dot), the report should not display a dot. An employee's name is made up of surname, first name and middle name which should all be concatenated together. To try to achieve this, I have the following statement in my report:
    decode(e.Surname, '.', ( LTRIM(RTRIM((INITCAP(e.FIRST_NAME)))||' '||INITCAP(e.MIDDLE_NAME)) ) ,
    e.FIRST_NAME, '.', ( LTRIM(RTRIM((INITCAP(e.Surname)))||' '||INITCAP(e.MIDDLE_NAME)) ) ,
    ( LTRIM(RTRIM((INITCAP(e.SURNAME )))||', '||INITCAP(e.FIRST_NAME)||' '||INITCAP(e.MIDDLE_NAME)) ) ) as emp_name
    FROM Employee e
    Problem: The above statement is only working for those employees with surname of . (dot). It's not working for first names of dot. How can I use the decode statement OR is there any other way of doing it without using the CASE statement?
    It seems my decode statement doesn't work with 2 different fields (surname, firstname) being tested within one decode statement.Thanks.

    Thank you so much InoL . I have used the ltrim with Replace but now have a new problem.
    Because I am joining Surname, First name and middle name together and put a comma after the Surname, the name now appears as follows:
    , Maria Ane (if Surname is a dot)
    Boiler, (if first name is a dot)
    I would like to get rid of a comma and only have comma when surname or first name does not have a dot, i.e. for those people with full names e.g. Blake, Anna Marie.
    InoL, how can I achieve this? Thanks.

  • Problem In Session State

    Hai, I'm Using VS2010 and SQL Server 2005.
    I have a problem in Session state;
    //View.aspx.cs
    // In this page just I store a textbox into a session variable.
    protected void btnEdit_Click(object sender, EventArgs e)
            Session["rollno"] = txtRollNo.Text;
                Response.Redirect("Edit.aspx");
    //Edit.aspx.cs
    //In this page I retrieve the session value which is stored in previous page
           protected void Page_Load(object sender, EventArgs e)
            txtRollNo.Enabled = false;
            if (!IsPostBack)
                txtRollNo.Text = Session["rollno"].ToString();
                getdata();
     public void getdata()
            SqlConnection con = new SqlConnection("Data Source=SERVICETEAM-PC;Initial Catalog=csc;User ID=sa;Password=kavi");
            con.Open();
            SqlCommand cmd = new SqlCommand("Select * from Csc where Roll_No='" + txtRollNo.Text + "'", con);
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read())
                txtName.Text = dr.GetString(1).ToString();
                txtAddress.Text = dr.GetString(2).ToString();
                txtMobileNo.Text = dr.GetString(3).ToString();
                txtYesNo.Text = dr.GetString(4).ToString();
    From the above code, I got an error when I press Edit button in View.aspx page.
    The Error is
    Description: An unhandled
    exception occurred during the execution of the current web
    request. Please review the stack trace for more information about the error and where it originated in the code. 
    Exception Details: System.Web.HttpException: A page can have only one server-side Form
    tag.
    Source Error: 
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack
    trace below.
    Help Me.....

    Hai,
    I'm using VS2010 and SQL Server 2005.
    I have a problem in Session state.
    See below is my code,
    //View.aspx.cs
    //Here I assign a textbox value to session
    protected void btnEdit_Click(object sender, EventArgs e)
            Session["rollno"] = txtRollNo.Text;
                Response.Redirect("Edit.aspx");
    //Edit.aspx.cs
    //Here I assign a session value to textbox, which is stored in last page.
    protected void Page_Load(object sender, EventArgs e)
            txtRollNo.Enabled = false;
            txtRollNo.Text = Session["rollno"].ToString();
            getdata();
    public void getdata()
            SqlConnection con = new SqlConnection("Data Source=SERVICETEAM-PC;Initial Catalog=csc;User ID=sa;Password=kavi");
            con.Open();
            SqlCommand cmd = new SqlCommand("Select * from Csc where Roll_No='" + txtRollNo.Text + "'", con);
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.Read())
                txtName.Text = dr.GetString(1).ToString();
                txtAddress.Text = dr.GetString(2).ToString();
                txtMobileNo.Text = dr.GetString(3).ToString();
                txtYesNo.Text = dr.GetString(4).ToString();
    From the above code If I the Edit button, It will show an error like 
           

  • Problem with mdx statements generated by CR

    Hello Experts,
    we have a problem concerning mdx-statements produced by Crystal Reports.
    We have built a report upon a query with a variable. Now within one Designer, the generated mdx statement looks like this:
    SELECT {[Measures].[4LPEKDIGEPNC4ENQA7Z0TN7MH]} ON COLUMNS FROM [MC_CO2010/C_BO_BSDB_1] SAP VARIABLES [ZKS__MSM] INCLUDING "432140" : "432140"
    Within another installed designer (same version etc.), the statement looks like this:
    SELECT {[Measures].[4LPEKDIGEPNC4ENQA7Z0TN7MH]} ON COLUMNS FROM [MC_CO2010/C_BO_BSDB_1] SAP VARIABLES [ZKS__MSM] INCLUDING [KSTL].[432140] : [KSTL].[432140]
    And only this version shows the data !
    Personally I know only statements like the last one (variable values in brackets). But only the first one (variable values in double quotes) does work. Does anyone know the reason for this ? How can we then achieve that the CR designer produces statements like the first one ?
    Thanks for your help in advance,
    Frank

    We´ve solved the problem:
    I discovered that on the computer that generated the "" statement, only CR2008 with SP3 was installed. Wheresas on the pc that generated the -statement, SAP Integration Kit (SIK) CR2008 SP3 AND SIK CR2008 Fixpack 3 was installed. So I de-installed SIK CR2008 Fixpack 3 and then both machines generated the same statements with the "".
    @Ingo:
    No, both values had been entered manually, so there was no difference in this. As I wrote above, the only differences where the addionally installed FP3.
    Noneheless, the mdx-statement with the "" seems strange to me. Is this something official ? If I take a look at the description for BW-Specific Enhancement for MDX:
    http://help.sap.com/SAPhelp_nw04/helpdata/en/a7/18533d6dd60610e10000000a114084/content.htm
    the seem to be ok and it is also the way I am used to it.

  • Problem with Dead States

    I am having a problem making dead states with my buttons. The
    way i have it set up I cannot just delete each button code from the
    frame where it's at. It's not working that way..Below I have
    attached pictures of the code in each frame the order the pictures
    are in are the order they are in the timeline in
    <a href="
    http://www.iankemp.com/images/indexmx3testt.swf">SWF
    File Here</a>
    http://www.iankemp.com/images/Picture1.png
    http://www.iankemp.com/images/Picture2.png
    http://www.iankemp.com/images/Picture3.png
    http://www.iankemp.com/images/Picture4.png
    http://www.iankemp.com/images/Picture5.png
    http://www.iankemp.com/images/Picture6.png
    http://www.iankemp.com/images/Picture7.png

    Please post in the DPS foum.
    http://forums.adobe.com/community/dps
    Bob

  • Problem deleting bank statements

    hi friends,
    i have 2 idocs processed which were same with different statement numbers. one was posted while the other was not posted. so i tried to delete the duplicate statement which was not posted through the program RFEBKA96 but after that i can still see the deleted statement number in the FEBA and FEBKO..but when i deleted the statement using RFEBKA96 it gave me messge what it was deleted in the following tables...
    dont know if am doing wrong....let me know its urgent
    thanks
    charlie

    Hi Charlie,
    SAP R/3 does not provide a standard transaction to delete bank statements from the Banks module in FI. This can lead to time-consuming problems when erroneous statements make their way into your system. While there is no transaction code, there is a report that allows you to delete bank statements. It has the added benefit of being able to work as timesaving testing tool that can be reused again and again. However, there is a risk when you use the report. If a user accidentally clicks the delete button without deselecting the found bank statements, the report deletes all bank statements for all company codes.
    Also check out this link
    http://help.sap.com/bp_bblibrary/500/Documentation/J03_BankStmt_EN_US.doc
    Assign points if useful
    Regards
    Genie

  • Problem in import statement

    Hi There,
    I am working on the expense management project using mobile so i just started with the Embedded SQL So,whenever i am trying with following code.
    import java.sql.*;
    public class ModelMIDlet
    private Connection Database;
    private Statement DataRequest;
    public ModelMIDlet()
    String url="jdbc:odbc:CustomerInformation";
    String uid="umesh";
    Stirng password="umeshD";
    try
    }catch(ClassNotFoundException er)
    System.err.println("Unable to load the JDBC/ODBC bridge" +er);
    System.exit(1);
    catch(SQLException er)
    System.err.println("Cannot connect to the database" +er);
    if(Database!=null)
    try
    Database.close();
    }catch(Exception e){}
    System.exit(2);
    try
    {}catch(SQLException er)
    System.err.println("SQL error" +er);
    if(Database!=null)
    try
    Database.close();
    catch(Exception ex){}
    System.exit(3);
    if(Database!=null)
    try
    Database.close();
    catch(SQLException er){}
    public static void main(String args[])
    final ModelMIDlet sql1=new ModelMIDlet();
    System.exit(0);
    it shows error after running that package java.sql.* does not exist.So please guide me about this problem is it necessary to use additional API related to SQL?

    I got this to work this morning. 
    When you try and set-up the SAP wsdl in .NET it complains about not seeing any port's or complex types.  This is because SAP has moved these out into seperate files.  .NET doesn't try to link these files at this time.  If you simply click on "Add as reference" in Visual Studio at the time of importing the WSDL your problems disappear like magic..
    Hope this helps someone..
    Jarrod

  • Problem with "if" statement in Dreamweaver

    I have successfully used "if" statements in the past with Dreamweaver, but I'm having a problem using it with images (i.e.  <img src = ).
    What I'm trying to accomplish is to display a default.jpg image if there is no image file name stored in a MySQL database.
    For example, if a team has a photo image, show that photo; otherwise, show a default image.  (The default image tells people how to submit a photo to me.)
    If I can't get this to work, I'll have to store a large number of image files with different names for the same "default.jpg" image.
    Thanks in advance for any help that you can provide.

    I may have misunderstood your problem... why can't you just set the default value of the column in the table to the path of your default image? Then, when you call that variable into the page, if there has been one set, it will display that, if not, it will display the default.
    If there is some reason that you can't do that (if I'm missing your point), this should accomplish the same thing (though, I still think that the easiest way is to simply store the default image URL in the table by default.)
    Set the DEFAULT value of the column in the database to "-1" - so if there is nothing there, it returns "-1".  Then put the following in the page:
    <?php IF ($row_test['team_pic']=="-1")
    $image1=('<img src="images/default_pic.jpg">');
    ELSE $image1=('<img src="'.$row_test['team_pic'].'">');
    ?>
    <?php echo $image1; ?>
    Where your database column is "team_pic", and your default image is "default_pic.jpg" stored in the /images folder.
    Make sense?

  • Cisco ASA 5505 Reset-I Problem with TCP State Bypass

    Hello,
    I have a Cisco ASA 5505 that functions as my primary firewall and a Mitel 5000 controller behind it. I have two external phone users that have been connecting through the firewall with no issues for six months until about two weeks ago. I am now seeing the following log entry on the phone trying to connect to the Mitel Controller.
    6
    May 16 2014
    14:52:52
    302014
    72.135.115.37
    6915
    192.168.20.2
    6801
    Teardown TCP connection 1203584 for outside:72.135.115.37/6915 to inside:192.168.20.2/6801 duration 0:00:00 bytes 0 TCP Reset-I
    My phones are designed to work with the Mitel 5000 and Mitel 3300 phone controllers. The 5000 will only use port 6800 for call control, while the 3300 will use 6801 (Secured Minet), 6802 (Minet SSH), and if those fail, port 6800 (Minet Unsecured). When the phones initiate a connection, they try 6801 first. If 6801 is unavailable, the phone controller adds the RST flag to the ACK packet. When the phone sees the RST flag, it is supposed to reset and use the next port (6802). The same process happens again for port 6802, then the phone knows to try 6800. The problem is that the ASA sees the RST flag now and terminates the connection at the firewall. Therefore, the phones never see the RST flag, and continue to try the connection with port 6801.
    I have tried to use the TCP State Bypass feature to correct the situation, but the log shows that the connection is still being terminated immediately by the firewall. I am a novice when it comes to configuring the ASA. Any help would be greatly appreciated, as the company that I bought the phone system from is out of troubleshooting options. I do not think that I have made any changes to the firewall around this time. I have packet captures and logs from my ASA and I have wireshark data on the inside of my network. I need to figure out how to configure the ASA so that it ignores the RST flag and sends the packet back to the source.
    Any help would be greatly appreciated!

    Thanks Rizwan,
    Still no luck.  I can't even ping the otherside (office)..  I am not sure if i'm running the debug rightway.   Here are my results...
    homeasa(config)# ping inside 10.10.5.254............. (Office CIsco ASA5505 IP on local side.  I also tried pinging the server on other side (office) whic is @10.10.5.10 and got the same result)
    Type escape sequence to abort.
    Sending 5, 100-byte ICMP Echos to 10.10.5.254, timeout is 2 seconds:
    Success rate is 0
    homeasa(config)# debug crypto isakmp 7
    homeasa(config)# debug crypto ipsec 7
    homeasa(config)# sho crypto isakmp 7
                                       ^
    ERROR: % Invalid input detected at '^' marker.
    homeasa(config)# sho crypto isakmp
    There are no isakmp sas
    Global IKE Statistics
    Active Tunnels: 0
    Previous Tunnels: 0
    In Octets: 0
    In Packets: 0
    In Drop Packets: 0
    In Notifys: 0
    In P2 Exchanges: 0
    In P2 Exchange Invalids: 0
    In P2 Exchange Rejects: 0
    In P2 Sa Delete Requests: 0
    Out Octets: 0
    Out Packets: 0
    Out Drop Packets: 0
    Out Notifys: 0
    Out P2 Exchanges: 0
    Out P2 Exchange Invalids: 0
    Out P2 Exchange Rejects: 0
    Out P2 Sa Delete Requests: 0
    Initiator Tunnels: 0
    Initiator Fails: 0
    Responder Fails: 0
    System Capacity Fails: 0
    Auth Fails: 0
    Decrypt Fails: 0
    Hash Valid Fails: 0
    No Sa Fails: 0
    Global IPSec over TCP Statistics
    Embryonic connections: 0
    Active connections: 0
    Previous connections: 0
    Inbound packets: 0
    Inbound dropped packets: 0
    Outbound packets: 0
    Outbound dropped packets: 0
    RST packets: 0
    Recevied ACK heart-beat packets: 0
    Bad headers: 0
    Bad trailers: 0
    Timer failures: 0
    Checksum errors: 0
    Internal errors: 0
    hjnavasa(config)# sh crypto ipsec sa peer 96.xxx.xxx.118
    There are no ipsec sas
    homeasa(config)#

  • Problem with Select Statements

    Hi All,
    I have a performance problem for my report because of the following statements.
    How can i modify the select statements for improving the performance of the report.
    DATA : shkzg1h  LIKE bsad-shkzg,
             shkzg1s  LIKE bsad-shkzg,
             shkzg2h  LIKE bsad-shkzg,
             shkzg2s  LIKE bsad-shkzg,
             shkzg1hu LIKE bsad-shkzg,
             shkzg1su LIKE bsad-shkzg,
             shkzg2hu LIKE bsad-shkzg,
             shkzg2su LIKE bsad-shkzg,
             kopbal1s  LIKE bsad-dmbtr,
             kopbal2s  LIKE bsad-dmbtr,
             kopbal1h  LIKE bsad-dmbtr,
             kopbal2h  LIKE bsad-dmbtr,
             kopbal1su  LIKE bsad-dmbtr,
             kopbal2su  LIKE bsad-dmbtr,
             kopbal1hu  LIKE bsad-dmbtr,
             kopbal2hu  LIKE bsad-dmbtr.
    *These statements are in LOOP.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1s , kopbal1s)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1su , kopbal1su)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1h , kopbal1h)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg1hu , kopbal1hu)
          FROM bsid
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2s , kopbal2s)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2su , kopbal2su)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'S'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2h , kopbal2h)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz EQ ''
         GROUP BY shkzg.
        ENDSELECT.
        SELECT shkzg SUM( dmbtr )
          INTO (shkzg2hu , kopbal2hu)
          FROM bsad
         WHERE bukrs = ibukrs
           AND kunnr = ktab-kunnr
           AND budat < idate-low
           AND shkzg = 'H'
           AND umskz IN zspgl
         GROUP BY shkzg.
        ENDSELECT.

    >
    Siegfried Boes  wrote:
    > Please stop writing answers if you understrand nothing about database SELECTS!
    > All above recommendations are pure nonsense!
    >
    > As always with such questions, you must do an analysis before you ask! The coding itself is perfectly o.k., a SELECT with an aggregate and a GROUP BY can not be changed into a SELECT SINGLE or whatever.
    >
    > But your SELECTS mustr be supported by indexes!
    >
    > Please run SQL Trace, and tell us the results:
    >
    > I see 8 statements, what is the duration and the number of records coming back for each statement?
    > Maybe only one statement is slow.
    >
    > See
    > SQL trace:
    > /people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy
    >
    >
    > Siegfried
    Nice point there Siegfried. Instead of giving constructive suggestion, people here give a very bad suggestion on using SELECT SINGLE combined with SUM and GROUP BY.
    I hope the person already look at your reply before he try using select single and wondering why he has error.
    Anyway, the most important thing is how many loop expected for those select statements?
    If you have like thousands of loop, you can expect a poor performance.
    So, you should also look at how many times the select statement is called and not only performance for each select statement when you're doing SQL trace.
    Regards,
    Abraham

Maybe you are looking for

  • Yellow WP Lines in sm50 --  Why?

    <b>Yellow WP Lines in sm50</b> Hi together, does someone knows for want logical event are yellow lines in sm50. So, I know red markers at the error column, but I can't find a description for what are yellow lines? The whole line in yellow in the back

  • User Exit to trigger after PGI

    Hi, Can any one help me on this........... Plz .. Urjent... I want to make some operation after PGI and I want to find out the user exit to triger after PGI... I dont know How to find out that exact .. Can any one help me on this ... I want the User

  • Weblogic12c and JDK 7 together not using login configuration file properly

    Hello, Little puzzled by this. I ve installed JDK 7 along with Weblogic 12c and made a custom installation of Weblogic to use JDK 7 as the Local JDK as mentioned in this doc http://docs.oracle.com/cd/E24329_01/doc.1211/e24492/jdk7.htm The JAVA_HOME i

  • Worn down. Hours w tech support. Yosemite won't upload files

    II'm die hard mac person. I think I'm done. I've spent hours with tech support. Nothing fixed. I've done clean install. sisconnected bluetooth. You name it.  I have clients waiting for files that will only upload at snails pace. Nothing works.  Yosem

  • I would like to turn off the CAUT ALM (caution alarm) feature

    Does anyone know how to turn off the alarm that beep three times when you turn off the car to remind you to take off the face plate?  I don't want to take off the face plate, and the beeping is driving me crazy!  The manual say you can turn it off by