Search This Blog

Friday, June 16, 2017

How can restore a backup on lower version of SQL Server:

How can restore a backup on lower version of SQL Server:

We have SQL command to find out SQL version.
SELECT @@VERSION  by this commant we can find out our SQL version.


Out Put:
Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64)   Apr  2 2010 15:48:46   Copyright (c) Microsoft Corporation  Developer Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )

Meaning of 4 digit output - 10.50.1600.1
1st digit product version (8 means, SQL 2000, 9 means SQL 2005, 10 means SQL 2008, 11 means SQL 2012).
2nd digit product level - different releases have different numbers. 10.00 is SQL 2008, 10.50 is SQL 2008 R2.
3rd digit - Service Pack to you SQL Server installation.
4th digit - one is a build number

Three cases we will face when restore SQL database one version to other version:
Source server is an older version and target server is a newer version of SQL Server.
For example:
Source: 9.00.2234.0 (SQL 2005)
Target: 10.00.5500.0 (SQL 2008 SP2)
Backups are compatible. You can restore a database backup on a newer version of SQL Server.

Source server and target server are the same product version and product level. They may differ on 3rd  or 4th  digit  in the version number.
For example:
Source server is 10.50.2876.0 and target is 10.50.2799.0.
Backups are compatible. Microsoft does not introduce significant changes in BACKUP/RESTORE functionality that breaks backward compatibility by a hotfix or Service Pack.
Source server and target server differ by 1st  or 2nd  digit - a product version or a product level and the target is older than the source.
For example:
Source: 11.00.2100 (SQL 2012)
Target: 10.00.5500 (SQL 2008 SP2)
Backups are incompatible. 

Thursday, June 8, 2017

Dynamic Message box, Alert Message popup box with java script

How can create Dynamic Alert Message box :



Evert times we need confirmation after data created or updated in database. In this case we can make one popup message box with help of java script we can also put dynamic value in this popup message box.

1 STEP:  Create 2 two function one for show message box or second one for hide message box.

2 STEP: Write CSS for message box design.

3 STEP: Create div where display message.

4 STEP: Write our message in label control in cs page.

1 STEP:

<script type="text/javascript">
    function ShowDialog(modal) {
      
        $("#overlay").show();
        $("#dialog").fadeIn();
        if (modal) {
            $("#overlay").unbind("click");
        }
        else {
            $("#overlay").click(function (e) {
                HideDialog();
            });
        }
        return false;
    }

    function HideDialog() {
        $("#overlay").hide();
        $("#dialog").fadeOut(300);

    }

</script>

2 STEP:<style type="text/css">
.web_dialog_overlaycm
{
    position: fixed;
    top: 25%;
    right: 0%;
    bottom: 5%;
    left: 40%;
    height: 29%;
    width: 56%;
    margin: 0;
    padding: 0;
    background: #f3c022;
    -moz-opacity: .15;
    z-index: 20000;
    display: none;
}

.web_dialogcm
{
    display: none;
    position: fixed;
    width: 54%;
    height: 24%;
    top: 27%;
    left: 41%;
    background-color: #ffffff;
   /* border: 1px solid #993333;*/
    border: 1px solid #5db2ff;
    padding: 0px;
    z-index: 20000;
    font-family: Verdana;
    font-size: 10pt;
}
    .style1
    {
        width: 100%;
    }
</style>

3 STEP:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <table class="style1">
        <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
                
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
   <div id="overlay" class="web_dialog_overlaycm" style="width: 20%; float: center;">
                <div id="dialog" class="web_dialogcm" style="width: 18%; float: center;">
                    <div style="width: 100%; float: center;">
                        <table style="width: 100%;">
                            <tr align="center">
                                <td style="text-align: center;">
                                  
                                </td>
                            </tr>
                             <tr align="center">
                                <td style="text-align: center;">
                                  
                                </td>
                            </tr>
                            <br>
                             <tr align="center">
                                <td style="text-align: center;">
                                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                                </td>
                            </tr>
                           
                           
                        </table>
                    </div>
                    <div style="width: 100%; float: left;">
                        <table id="tblZoom" style="width: 200px;" align="center">
                            <tr id="Zoom1" runat="server">
                                <td id="Td2" runat="server">
                                    <div id="divZoom" style="border: 1px solid #5db2ff; float: center; vertical-align: top;"
                                        align="center">
                                    </div>
                                </td>
                            </tr>
                            <br>
                             <tr align="center">
                                <td style="text-align: center;">
                                  
                                </td>
                            </tr>
                             <tr align="center">
                                <td style="text-align: center;">
                                    
                                </td>
                            </tr>
                             <tr align="center">
                                <td style="text-align: center;">
                                    <input id="btnClose" type="button" value="OK" onclick="HideDialog()" />
                                </td>
                            </tr>
                           
                        </table>
                    </div>
                </div>
            </div>
    </form>
</body>
</html>

4 STEP:

using System;
using System.Data;
using System.Globalization;
using System.Resources;
using System.Threading;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Web;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
       
        Label1.Text = "Country Created Or Updated Sucessfully In Database.";

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "function", "ShowDialog(true);", true);
    }
}