How to compare the values stored in the list

Hi,
I am having the requirement that i want to compare the values stored in the list.How to store the values in the list and compare the list values stored inside it.
Regards,
Ahamad

http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#sort(java.util.List)
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#sort(java.util.List,%20java.util.Comparator)
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Comparator.html
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Comparable.html

Similar Messages

  • How can i get the value stored in the session object using its sessionid

    how can i get the value stored in the session object using its sessionid by running stand alone java application

    myforum wrote:
    how can i get the value stored in the session object using its sessionid by running stand alone java applicationThis does not seem to make sense! You need at least to give a lot more detail of what you are doing.

  • I need to add the values stored in the session object into the html textbox

    Dear Sir,
    i have been trying to create an edit employee details page
    What i have done till now is as follow:
    1. Got employee id from HTML page.
    2. Compared it with the id stored in the database.
    3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.
    4. Dispatched the session values to another servlet EditEmpDetails2.java
    what i need to do now
    5. Now i need to set the session values in the text field of the html form
    6. I also need to be able to edit those vales and store the edited values in the database.
    Please help me as i have tried doing it for 1 week without any clues
    i have tried to create a html page which is something like this:
    <html>
    <head>
    <title>Edit Employee Details Page</title>
    <body BGCOLOR="red" text="black">
    <h1 ><font color="black">Edit Employee Details Page</font></h1>
    <form action = "EditEmpDetails" method="Get">
    <table width="50% align="center"
    <tr><td>Employee ID: </td>
    <td><INPUT TYPE="TEXT" name="employeeid"<br></td></tr>
    <tr><td><center><input type="submit" value="submit"></center></td></tr>
    <tr><td><center><input type="reset" value="reset" ></center></td></tr>
    </table>
    </form>
    </body>
    </html>
    design of my servlet EditEmpDetails.java
    public void EditEmpDetails1 extends HttpServlet
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    PrintWriter out = response.getWriter();
    response.setContentType("text/html");
    HttpSession session = request.getSession();
    String employeeid;
    String X = request.getParameter("employeeid");
    System.out.println("Employee iD:" + X);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:murphy");
    String query = "Select * from users where employeeid=?";
    PreparedStatement stat = con.prepareStatement(query);
    System.out.println(stat);
    stat.setString(1,X);
    ResultSet rs = stat.executeQuery();
    while(rs.next())
    String Z = rs.getString(password);
    if(Z.equals(X))
    String A = rs.getString(1);
    session.setAttribute("employeeid", A);
    String B = rs.getString(2);
    session.setAttribute("firstname", B);
    String C = rs.getString(3);
    session.setAttribute("lastname", C);
    String D = rs.getString(4);
    session.setAttribute("gender", D);
    String E = rs.getString(5);
    session.setAttribute("dateofbirth", E);
    String F = rs.getString(6);
    session.setAttribute("address", F);
    String G = rs.getString(7);
    session.setAttribute("postalcode", G);
    String H = rs.getString(8);
    session.setAttribute("phone", H);
    String I = rs.getString(9);
    session.setAttribute("mobile", I);
    String J = rs.getString(10);
    String url = "/EditEmpDetao;s.java";
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url)
    dispatcher.forward(request,response);
    catch (Exception e)
    system.out.println(e)
    I do not know how to put the values stored in the session object into the html text box

    3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.do you really need to store this in session object?
    5. Now i need to set the session values in the text field of the html form which form? in a new html/jsp page? i suggest go for a JSP
    In your JSP page use JSP expression tags to put the session attributes.
    it's something like : <input type='text' name='employeeid' value='<%= session.getAttribute("employeeid") %>' >and you need to generateanother servlet for saving the details/modifications to the database.
    I think i m clear enough.
    if you need more clarifications. just try it and then post your problem.
    Diablo

  • How to display the values stored in the database in the combobox on load?

    I am develping one application where in
    I wanted to display the values in the combobox which I am taking from the database and in the same form passing that value in same form after selecting it,My program is running fine for the first time but next time it is giving me NullPointerException.
    So can anyone tell me please how I should develop the this application to avoid this exception?
    Thank You
    Praddy

    Thanx a lot for showing interest in answering my query.I am pasting my code for ur reference.Please try to reply ASAP.
    Thank You,
    Praddy.
    CODE:
    ======
    <html>
    <head>
         <script language="javascript">
              function submitthisform(thisForm)
                   thisForm.submit();                    
         </script>
    </head>
    <body>
    <form method=post name=samepgm>
    Select City:     <select name=city onChange='submitthisform(samepgm)'><br><br><br>
    <option value=''></option>
    <option value='All'>All</option>
    <%@ page language="java" import="java.sql.*" %>
    <%
              String scity = request.getParameter("city");
              System.out.println(scity);
              Connection con = null;
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              con = DriverManager.getConnection("jdbc:odbc:property","","");
              Statement st = con.createStatement();          
              ResultSet rs1 = st.executeQuery("select distinct hcity from housefinance");
              while(rs1.next())
                   //String ohname = rs1.getString("hname");     
                   String     ocity = rs1.getString("hcity");     
                   //out.println(ohname +"<br>");
                   out.println(ocity +"<br>");
    %>
    <br><br><br><option value='<%=ocity%>'><%=ocity%></option><br>
    <%               }
                   rs1.close();
              if(scity.equals("All"))
              ResultSet rs2 = st.executeQuery("select * from housefinance");      
              while(rs2.next())
                   String     ohname = rs2.getString("hname");     
                   String     ohadd1 = rs2.getString("hadd1");
                   //String ohadd2 = rs2.getString("hadd2");
                   String     ohcity = rs2.getString("hcity");
                   String     ohpcode = rs2.getString("hpcode");
                   String     ohtelno = rs2.getString("htelno");
                   String     ohfaxno = rs2.getString("hfaxno");
                   String     ohemail = rs2.getString("hemail");
                   String     ohmobile = rs2.getString("hmobile");     
    %>
    <pre>
    <tr>
    <td><p>Company          :     <%=ohname%> </p></td>
    <td><p>Address          :     <%=ohadd1%></p></td>
    <td><p>City          :     <%=ohcity%> </p></td>
    <td><p>Pin          :     <%=ohpcode%></p></td>
    <td><p>Telphone          :     <%=ohtelno%></p></td>
    <td><p>Fax No:          :     <%=ohfaxno%></p></td>
    <td><p>Email          :     <%=ohemail%></p></td>
    <td><p>Mobile No.     :     <%=ohmobile%></p></td>
    </tr>
    </pre>
    <%
              else
    ResultSet rs = st.executeQuery("select * from housefinance where hcity like '%"+scity+"%'");
              while(rs.next())
                   String     ohname = rs.getString("hname");     
                   String     ohadd1 = rs.getString("hadd1");
                   //String ohadd2 = rs.getString("hadd2");
                   String     ohcity = rs.getString("hcity");
                   String     ohpcode = rs.getString("hpcode");
                   String     ohtelno = rs.getString("htelno");
                   String     ohfaxno = rs.getString("hfaxno");
                   String     ohemail = rs.getString("hemail");
                   String     ohmobile = rs.getString("hmobile");     
    %>
    <tr>
    <td><p>Company          :     <%=ohname%> </p></td>
    <td><p>Address          :     <%=ohadd1%></p></td>
    <td><p>City          :     <%=ohcity%> </p></td>
    <td><p>Pin          :     <%=ohpcode%></p></td>
    <td><p>Telphone          :     <%=ohtelno%></p></td>
    <td><p>Fax No:          :     <%=ohfaxno%></p></td>
    <td><p>Email          :     <%=ohemail%></p></td>
    <td><p>Mobile No.     :     <%=ohmobile%></p></td>
    </tr>
    <hr>
    <%               }
    %>
    </select>
    </form>
    </body>
    </html>

  • Finding the average of all the values stored in a two dimentional array

    public int avg(int[][] numbers2){
        int sum = 0;
        float avg = 0;
        for(int r = 0; r < numbers2.length; r++)
          for(int c = 0; c < numbers2[r].length; c++){
              sum += numbers2[r][c];
          }So I have this code that of course finds the sum of all the values stored in the array int[][] numbers. What I am having an issue with is finding the average of the numbers. When I attempt to use:
    avg = sum / numbers2.length; I get the sum / 3 because my array looks like:
    int[][] numbers2 = {{1, 2, 3},
                                {4, 5, 6},
                                {7, 8, 9}
                                          };Any ideas on what I should do or where I could find information on this process?

    2 dimensional arrays have 2 lengths:
    myArray.length and myArray[0].length
    The first one I believe is fixed, the second one may vary from row to row. But if you know that it won't vary, then you can just use the [0] row length.

  • How to find out the type of the value stored in a string variable?

    Hi,
    How do i find out the type of the value stored in a string variable?
    for example,
    I have a string variable str, in which the following type of values wil be stored
    1) Intger
    2) Long
    3) boolean
    4) Char
    Is there any method to find out the type of the value, anything like str.getType()?. Please kindly help me. Thanks in advance.

    Hi All, i'm sorry for the double posting, by mistake it occured.
    Thanks for your replies, i have a string variable str, in which the value is stored and i have another string variable type, in which the type of the value is stored.
    For example,
    String str = "15";
    String type = "Integer";
    Is there any way to verify whether the value stroed in str is of type stored in the variable 'type'. I want to write a method of type boolean, it will throw true of the value stored in str is of type 'type'. Thanks

  • How to implement multiple Value Helps within the same Application ??

    Dear Experts,
    I want to implement multiple value helps in the same view.For that I have declared exporting parameters of type 'wdy_key_value_table.' within the component controller for each of the value helps.While I do activate and test the application I get the following error :
    The following error text was processed in the system HE6 : A row with the same key already exists.
    The error occurred on the application server hsdnt24s11_HE6_00 and in the work process 4 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: VALUESET_BSART of program /1BCWDY/9VSHJWRNR0EZPKFT3ZKC==CP
    Method: IF_PO_VIEW1~VALUESET_BSART of program /1BCWDY/9VSHJWRNR0EZPKFT3ZKC==CP
    Method: WDDOINIT of program /1BCWDY/9VSHJWRNR0EZPKFT3ZKC==CP
    Method: IF_WDR_VIEW_DELEGATE~WD_DO_INIT of program /1BCWDY/9VSHJWRNR0EZPKFT3ZKC==CP
    Method: DO_INIT of program CL_WDR_DELEGATING_VIEW========CP
    Method: INIT_CONTROLLER of program CL_WDR_CONTROLLER=============CP
    Method: INIT_CONTROLLER of program CL_WDR_VIEW===================CP
    Method: INIT of program CL_WDR_CONTROLLER=============CP
    Method: GET_VIEW of program CL_WDR_VIEW_MANAGER===========CP
    Method: BIND_ROOT of program CL_WDR_VIEW_MANAGER===========CP
    I dont know how to implement multiple value helps.Need your help on this.
    Regards,
    Mamai.

    Hi
    Hint is : A row with the same key already exists it means , It is assigning the same value/Key to row and you are calling it at WDDOINIT  so it giving error at the time of initialization .
    Better way to do the coding at some event in view OR if not possible than just execute the first value help in wddoinit later clear all the value before gettig the other Value help. Code it at WdDoModify View to get its run time behaviour.
    BR
    Satish Kumar

  • Using the value "Image/*" for the accept attribute of the HTML input Element, how can I add .pdf to the array of preconfigured file types (.jpe, .jpg, .jpeg, .?

    On a form, using the value "image/*" for the accept attribute of the HTML input Element, how can I add .pdf to the array of pre-configured file types (.jpe, .jpg, .jpeg, .gif, .png, .bmp, .ico, .svg, .svgz, .tif, .tiff, .ai, .drw, .pct, .psp, .xcf, .psd, .raw)?
    Say I wanted to add .gif, .jfif or .ico. I find this array limited, how can I add types to image?
    <input type="file" name="file" accept="image/*" id="file" />
    mimeTypes.rdf does not seem to allow this.

    ''mimeTypes.rdf'' has nothing to do with web development. It's a file that stores your file handling preferences (e.g. if you want ZIP files automatically saved or opened).
    You can't change the file types of the pre-defined content specifiers (audio/*, video/*, image/*), but you can specify additional MIME types. To add PDF to your above example,
    <pre><nowiki><input type="file" name="file" accept="image/*,application/pdf" id="file" /></nowiki></pre>
    For details, see
    * [https://developer.mozilla.org/En/HTML/Element/Input developer.mozilla.org/En/HTML/Element/Input]

  • How to get default values while using the transaction "BP"

    Hi Group,
    I have a query on how to get default values while using the transaction <b>BP</b>?
    The thing is:
    when I enter into the transaction "BP", I need to see some default values to some of the input fields in the screen.
    how can I achieve this?
    So please kindly let me know the procedure to achieve this.
    Thanks & Regards,
    Vishnu.

    Hi,
    The events of BDT can be used to default some fields on creating a partner.
    For this create a function module for ISDAT. attach that event in BUS7.
    In the ISDAT funtion modulethe following code should be used.
    For example to set the nationality:
    I_BUSDEFAULT-NATIO = 'DE.
    CALL FUNCTION 'BUP_BUPA_FIELDVALUES_SET'
    EXPORTING
    i_busdefault = I_BUSDEFAULT
    Regards, Smita.

  • How to get the value field of the return parameters for an action step in teststand sequence file programatically using c#

                    Sequence mySequence = myEngine.NewSequence();
                    mySequence.Name = "myAction";
                    //Create new step of type Action and set Name
                    Step mystep = myEngine.NewStep(AdapterKeyNames.DotNetAdapterKeyname, StepTypes.StepType_Action);
                    mystep.Name = "GetStringObject";
                    //Obtain the code module from the step
                    DotNetModule myModule = mystep.Module as DotNetModule;
                    //Set properties of the module
                    myModule.SetAssembly(DotNetModuleAssemblyLocations.DotNetModule_AssemblyLocation_File, @"C:\Documents and Settings\My Documents\Visual Studio 2005\Projects\HelperClass\HelperClass\bin\Debug\HelperClass.dll");
                    myModule.ClassName = "Class1";
                    myModule.MemberType = DotNetModuleMemberTypes.DotNetMember_GetProperty;
                    myModule.MemberName = "StringObject";
                    mySequence.InsertStep(mystep, 0, StepGroups.StepGroup_Setup);
                    mySequence.Locals.NewSubProperty("StringObject", PropertyValueTypes.PropValType_Reference, false, "", 0);
                    DotNetParameterDirections reference = mySequence.Locals as DotNetParameterDirections;
                    mySequence.Locals.GetPropertyObject("StringObject", 0);
                    myModule.ClassReference = "Locals.StringObject";
                    myModule.LoadPrototypeFromMetadataToken(385875969, 0);
    After this I am not able to proceed.herewith attached documents contain screenshot of teststand file marked red is to be solved. How to define the value field of the return parameters?
    Attachments:
    HelperClass.cs ‏1 KB
    ex1.gif ‏2305 KB

    Please see my answer to your question on page two of the following forum thread:
    Programmatically generating DotNet Steps in TestStand
    Manooch H.
    National Instruments

  • How can I delete songs stored in the Cloud but without deleting them from my mac?

    How can I delete songs stored in the Cloud but without deleting them from my mac?

    You can do it, but you need another library signed in to iTunes match. That second library shouldn't have any local files stored.
    Delete the entry from that second library and it will ask you to confirm that you want to remove the file from the cloud. Confirm that you do.
    Now, as long as you don't delete the file from your main library it will have an iCloud status of "removed" and won't be in the cloud or try add it again.
    However, if you sign out of match on that computer and then sign in again it will then re-add it to the cloud, so this isn't a method to use if you tend to turn match on and off much.
    I have had the Beatles Mono albums in my main library, but not in the cloud, for a while now without any problems.

  • I have a ipod that had photos synchronised to an old computer that has sinced crashed and the data can not be recovered. How do I recover the photos stored on the IPOD to my new computer?

    I have a ipod that had photos synchronised to an old computer that has sinced crashed and the data can not be recovered. How do I recover the photos stored on the IPOD to my new computer?

    You'll likely need the assistance of some sort of 3rd party software.  Keep in mind that the photos on your iPod are only scaled down thumbnail versions of the originals.  So even if you do manage to copy them backt to your PC, they will not be in their full original resolution.
    Do a simple Google search for "copy photos from ipod" and you should get a number of hits that can assist you.
    B-rock

  • How to capture the value selected in the drop down box

    Hi all,
    I am populating values in  drop down box by using FM vrm_set_values in module pool.
    like below
    01  ABC
    02 ACB
    03 BCA
    04 CAB
    in module pool drop down box element name is RQGM-VALUE.
    Problem is what ever the value is select in the drop down box from above element RQGM-VALUE is not filling any value.
    i need to capture the value selected in the drop down box and pass it to another variable.

    Hi,
    Refer this standard code. Your issue will be resolve.
    REPORT demo_dynpro_dropdown_listbox.
    TYPE-POOLS vrm.
    DATA: name  TYPE vrm_id,
          list  TYPE vrm_values,
          value LIKE LINE OF list.
    DATA: wa_spfli TYPE spfli,
          ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    TABLES demof4help.
    name = 'DEMOF4HELP-CONNID'.
    CALL SCREEN 100.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE init_listbox OUTPUT.
      CLEAR demof4help-connid.
      SELECT  connid cityfrom cityto deptime
        FROM  spfli
        INTO  CORRESPONDING FIELDS OF wa_spfli
       WHERE  carrid = demof4help-carrier2.
        value-key  = wa_spfli-connid.
        WRITE wa_spfli-deptime TO value-text USING EDIT MASK '__:__:__'.
        CONCATENATE value-text
                    wa_spfli-cityfrom
                    wa_spfli-cityto
                    INTO value-text SEPARATED BY space.
        APPEND value TO list.
      ENDSELECT.
      CALL FUNCTION 'VRM_SET_VALUES'
           EXPORTING
                id     = name
                values = list.
    ENDMODULE.
    MODULE user_command_100.
      save_ok = ok_code.
      CLEAR ok_code.
      IF save_ok = 'CARRIER' AND NOT demof4help-carrier2 IS INITIAL.
        LEAVE TO SCREEN 200.
      ELSE.
        SET SCREEN 100.
      ENDIF.
    ENDMODULE.
    MODULE user_command_200.
      save_ok = ok_code.
      CLEAR ok_code.
      IF save_ok = 'SELECTED'.
        MESSAGE i888(sabapdocu) WITH text-001 demof4help-carrier2
                                            demof4help-connid.
      ENDIF.
    ENDMODULE.

  • How to monitor the values transferred to the jump query in a debug mode?

    Dear experts,
    There is a problem in the interface of two qeuries. In the first query, the infoobject is defined as a global filter with a constant. I added this infoobject in the interface via RSBBS.
    Nevertheless, if i run the jump query, the value in this InfoObject is not taken into account by the jump query.
    Does anybody know whether there is a method to debug (monitor) the values tranferred to the jump query? For example, in the transaction RSRT or others.
    Thanks in advance!

    in RSRT- EXECUTE+DEBUG => breakpoint in RRI transpormations
    also see the note 1053310
    Regards, Ragz

  • There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.

    I have been looking at my code for hours now and cant figure out what is wrong. The error has kept popping up even when i thought i had fixed everything. maybe a second set of eyes could help me out here. If you could help me out it would be much appreciated.
    USE [ConorsSetKits]
    GO
    CREATE TABLE Customers (
    CustomerID Int NOT NULL IDENTITY(1000,1),
    LastName NChar(30) NOT NULL,
    FirstName NChar(30) NOT NULL,
    Address NChar(50) NOT NULL,
    City NChar(30) NOT NULL,
    State NChar(2) NOT NULL,
    Zip Numeric(5) NOT NULL,
    Email NVarChar(50) NOT NULL,
    DateOfBirth Numeric (4) NOT NULL,
    CONSTRAINT CustomersPK PRIMARY KEY(CustomerID),
    CONSTRAINT ValidZip
    CHECK ( [Zip] LIKE '[0-9][0-9][0-9][0-9][0-9]' ),
    CONSTRAINT ValidState
    CHECK( LEN([State]) = 2),
    CONSTRAINT DateOfBirth
    CHECK ([DateOfBirth] BETWEEN '1920-01-01' AND getdate() - 5844));
    CREATE TABLE Sets (
    SetID Int NOT NULL IDENTITY(1000,1) Primary Key,
    SetName NChar(20) NOT NULL,
    SetType NChar (20) NOT NULL,
    Price Numeric (20) NOT NULL,
    Quantity Numeric (50) NOT NULL,
    CONSTRAINT SetTypeCheck
    CHECK (SetType IN ('Planes','Tanks','Robots','Cars','Helicopters','Boats','Trains','Motorcycles','Jets')),
    CONSTRAINT ValidQuantity 
    CHECK (Quantity >= 0)
    CREATE TABLE Orders (
    OrderID Int NOT NULL IDENTITY(1000,1),
    CustomerID Int NOT NULL,
    OrderDate Date NOT NULL,
    CONSTRAINT CAIntPK PRIMARY KEY(OrderID, CustomerID),
    SET IDENTITY_INSERT dbo.CUSTOMER OFF
    SET IDENTITY_INSERT dbo.Sets OFF
    SET IDENTITY_INSERT dbo.Orders OFF
    SET IDENTITY_INSERT dbo.CUSTOMER ON
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1000, 'Janes', 'Jeffrey', '123 W. Elm St', 'Renton', 'WA', '98055',
    '[email protected]',1985);
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1001, 'Smith', 'David', '813 Tumbleweed Lane', 'Loveland', 'CO', '81201', 
    '[email protected]',1992);
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1015, 'Twilight', 'Tiffany', '88 1st Avenue', 'Langley', 'WA', '98260',
    '[email protected]',1972);
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1033, 'Smathers', 'Fred', '10899 88th Ave', 'Bainbridge Island', 'WA', '98110',
    '[email protected]',1980);
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1034, 'Frederickson', 'Mary Beth', '25 South Lafayette', 'Denver', 'CO', '80201',
    '[email protected]',1970);
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1036, 'Warning', 'Selma', '205 Burnaby', 'Vancouver', 'BC', '80201',
    '[email protected]',1981);
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1037, 'Wu', 'Susan', '105 Locust Ave', 'Atlanta', 'GA', '30322',
    '404', '653-3465', '[email protected]',1971);
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1040, 'Gray', 'Donald','55 Bodega Ave', 'Bodega Bay', 'CA', '94923',
    '[email protected]',1985);
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1041, 'Johnson', 'Lynda', '117 C Street', 'Washington', 'DC', '20003',
    '[email protected]',1969);
    INSERT INTO Customers
    (CustomerID, LastName, FirstName, Address, City, State, Zip,
    Email, DateOfBirth)
    VALUES (
    1051, 'Wilkens', 'Chris', '87 Highland Drive', 'Olympia', 'WA', '98508',
    '[email protected]',1994); 
    SET IDENTITY_INSERT dbo.CUSTOMER OFF
    SET IDENTITY_INSERT dbo.Sets ON
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1000, 'MysterySet1','Planes',$29.99,10);
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1001, 'MysterySet2','Planes',$19.99,10);
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1002, 'MysterySet4','Tanks',$39.99,10);
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1003, 'MysterySet3','Robots',$19.99,10);
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1004, 'MysterySet5','Cars',$29.99,10);
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1005, 'MysterySet6','Boats',$29.99,10);
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1006, 'MysterySet7','Trains',$39.99,10);
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1007, 'MysterySet8','Motorcycles',$9.99,10);
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1008, 'MysterySet9','Helicopters',$29.99,10);
    INSERT INTO Sets
    (SetID, SetName, SetType, Price, Quanity)
    VALUES (
    1009, 'MysterySet10','Jets',$29.99,10);
    SET IDENTITY_INSERT dbo.Sets OFF
    SET IDENTITY_INSERT dbo.Orders ON
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1000, '2012-12-12');
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1000, '2013-12-30');
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1005, '2013-08-30');
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1004, '2013-12-30');
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1004, '2013-08-31');
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1004, '2014-03-25');
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1002, '2012-11-14');
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1001, '2012-11-14');
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1001, '2013-01-05');
    INSERT INTO Orders 
    (OrderID, OrderDate)
    VALUES 
    (1006, '2012-06-22');
    SET IDENTITY_INSERT dbo.Orders OFF

    Price Numeric (20) NOT NULL,
    I do not think you understand this datatype?  Go look at the values you are attempting to insert into this column.  For example, "$29.99".  After the insert, what value is actually stored in that column? 
    DateOfBirth Numeric (4) NOT NULL,
    No. Just No.  Either change the column name to faithfully represent what values you intend to store (and apply the appropriate constraints) or change the datatype and the values that you intend to store to match the column name.  And the constraint
    that you do have:
     CONSTRAINT DateOfBirth
     CHECK ([DateOfBirth] BETWEEN '1920-01-01' AND getdate() - 5844));
    is both logically suspect and syntactically wrong. First, the upper boundary will be computed as 1999-04-29 15:50:21.670.  But, of course, your column is a whole number of no more than 4 digits.  The same issue applies to your lower boundary. 
    A simple select statement will show you those errors
    select cast('1920-01-01' as numeric(4)), getdate() - 5844, cast(getdate() - 5844 as numeric(4));
    An insert statement fails with the same error.  Because, of course, your boundary values must actually be converted to numeric(4) in order to compare them against the value contained in the column.   Generally, you can convert from
    string to numeric - IF the content of the string actually contains a value that is numeric and can be converted into the specific type needed.  Not so in this case.  Is this 16 year period (5844 days) significant for some reason?  You should
    document it here in your DDL with a comment, because it is unlikely to be documented (and kept current) anywhere else. 
    And lastly, your script has:
    SET IDENTITY_INSERT dbo.CUSTOMER OFF
    That is not the name of your table, and therefore that statement also fails.  The table name you used is plural. 

Maybe you are looking for

  • CS4 project into CS5?

    Will a CS4 project open in CS5 (Maybe you could do a test on this Harm if you have time.) I would like to know so I can plan project migration to a new system. Answer would be good for the CS5 FAQ sub forum

  • Message Split Comes Before Mapping

    Hi, Can anybody explains the following queries.... 1.Why Message Split Comes Before Mapping in Pipeline Steps? 2.What do you mean by Collaborative Profile and Collaborative Agreement? 3.What are Context Path, Context Object and Context Handling? 4.Wh

  • Add a new hard-drive

    Hi, I need to install a new hard-drive in order to upgrade to Solaris 10. Solaris 8 is currently installed. If I do a probe-all while booting, I can see both hard-drives and the cdrom drive. But when I want to format the disk, it is not recognised (f

  • Paid for membership. Can't use Develop Module in LR5

    I recently paid for the $9.99 monthly plan. I received an email confirming so and have been charged on my bank statement. When I try to use the Develop module in Lightroom 5, a message appears saying it is disabled and that I need to renew my members

  • Installation of Photoshop Elements

    When installing PHE it stops at Shared Technologes and the installation rolls back. Why?