The difference between ongoing charity (sadaqah jaariyah) and other kinds of charity
Question

                Peace be upon you and the mercy of Allaah and his blessings. May Allaah reward you with good on behalf of Islam and the Muslims. Is there any difference between charity and ongoing charity? If there is a difference, we would like to know some examples of charity and some examples of ongoing charity. If an ongoing charity is destroyed – such as if a man builds a mosque then this mosque is destroyed – will he have the reward of that mosque until the Day of Resurrection? May Allaah reward you with good.
Praise be to Allah.
    Ongoing charity is the waqf (“Islamic endowment”) which may 
    take many forms. The definition of a waqf is that the origin is “frozen” and 
    the fruits are donated for the sake of Allaah, as was narrated by 
    al-Bukhaari (2737) and Muslim (1633) from Ibn ‘Umar (may Allaah be pleased 
    with him), that ‘Umar ibn al-Khattab (may Allaah be pleased with him) was 
    given a share of land at Khaybar. He came to the Messenger of Allaah  
    (peace and blessings of Allaah be upon him) and asked him what he should do 
    with it. He said: “O Messenger of Allaah, I have been given a share of land 
    at Khaybar and I have never been given any wealth that is more precious to 
    me than it. What do you command me to do with it?” He said: “If you wish, 
    you can ‘freeze’ it and give it in charity.” So ‘Umar gave it in charity and 
    stipulated that it was not to be sold, given as a gift or inherited, and he 
    gave it in charity to the poor, relatives and slaves, for the sake of Allaah 
    and for wayfarers and guests; there was no sin on the one appointed to look 
    after it if he ate from it on a reasonable basis, and fed others without 
    storing anything for the future.” 
Ibn Maajah (242) narrated 
    that Abu Hurayrah said: “The good deeds that will reach a believer after his 
    death are: knowledge which he learned and then spread; a righteous son whom 
    he leaves behind; a copy of the Qur’aan that he leaves as a legacy; a mosque 
    that he built; a house that he built for wayfarers; a canal that he dug; or 
    charity that he gave during his lifetime when he was in good health. These 
    deeds will reach him after his death.” This hadeeth hwas classed as hasan by 
    al-Albaani in Saheeh Ibn Maajah. 
Ongoing charity may mean 
    building a mosque, buying Mushafs (copies of the Qur’aan) to be placed in 
    the mosque, or designating a house or a place as a waqf so that its income 
    is spent on the poor, orphans, relatives, seekers of knowledge or others as 
    stipulated by the one who establishes the waqf, or donating money to build a 
    charitable hospital, and so on. 
With regard to 
    charity that is not ongoing, this is charity in which the thing given is not 
    “frozen”, rather it is given to the poor to become his property and be made 
    use of however he wishes, such as giving him money, food, clothing, medicine 
    or furniture. 
If a person establishes a 
    mosque as a waqf, then it is destroyed or falls down, it is permissible to 
    sell part of it in order to renovate the rest. If it is not possible to make 
    use of any part of it, then the whole thing may be sold and the money 
    donated to another waqf. Ibn Qudaamah (may Allaah have mercy on him) said: 
    “If a waqf is destroyed and nothing is left of it, it may be sold and the 
    money used to buy something to be given back to the people in charge of the 
    waqf, and it should be made a waqf like the first one was. The same applies 
    to a horse kept for jihad, if it is no longer fit for fighting, it should be 
    sold and the money used to buy another one that is fit for jihad. What we 
    conclude from this is that if a waqf is destroyed and is no longer of any 
    use, such as a house that collapses or land that is ruined and becomes dead 
    and no longer fit for cultivation, or a mosque from which the people move 
    away, and is now in a place where people do not pray, or it becomes too 
    small for the people and cannot accommodate them all, or it falls into 
    disrepair, and it cannot be maintained except by selling part of it, then it 
    is permissible to sell part of it in order to take care of the maintenance 
    of the rest of it. If it is not possible to use any part of it, then the 
    whole thing may be sold. Ahmad said, according to a report narrated by Abu 
    Dawood: if there are two pieces of wood in the mosque which are of some 
    value, it is permissible to sell them and spend the money raised on the 
    mosque. According to a report narrated by Saalih: the mosque may be removed 
    to another location if there is the fear of it being robbed or if the 
    location is in a filthy area. Al-Qaadi said: i.e., if that prevents people 
    from praying there. And he stated that it is permissible to sell its 
    courtyard, according to a report narrated by ‘Abd-Allaah. The imam should 
    give testimony to that effect (i.e., that these changes are necessary)
    
From al-Mughni, 
    5/368.
 So long as the waqf is 
    still in existence, the reward for its founder will be ongoing; the same is 
    also true if the original waqf is sold and the money put into a new waqf. 
    Whoever builds a mosque will have the reward promised for that. This is what 
    is narrated in the words of the Prophet  (peace and blessings of Allaah 
    be upon him): “Whoever builds a mosque for the sake of Allaah, even if it is 
    like the nest of a sand grouse, Allaah will build for him a house in 
    Paradise.” The hadeeth gives an example of building the smallest thing 
    possible. Narrated by Ahmad, 2157; classed as saheeh by al-Albaani in 
    Saheeh al-Jaami’. And Allaah knows best .