Posts

Showing posts from April, 2017

diffrance b/w StructCopy() and Duplicate()

StructCopy(): Creates a clone of the structure  by reference  (clones top level keys and values by value and nested structures by reference) Duplicate(): Creates a clone of any type of objects (that can be a structure)  by value. Therefore, We need to be very very careful while creating a clone of a structure by using StructCopy(), because any change to the cloned structure will be reflected in master structure (as it is cloned by reference). This might create side effects in the program.   When we clone by Duplicate(), any changes with the cloned structure will NOT be reflected in the master structure (as it is cloned by value). So it will not have any side effects in the program.

How to deploy a war file in Tomcat 7

Image
up vote 46 down vote step-1. here I'm deploying  pos.war  First go to tomcat webapps folder and paste it step-2. go to tomcat-> bin  folder start tomcat by clicking  startup.bat step-3. go to browser write localhost:port/project name eg.  localhost:8080/pos  (here my tomcat run on port 8080) Done....

difference between primary key and unique key

Primary Key: There an only be one primary key in a table In some DBMS it cannot be  NULL  - e.g. MySQL adds  NOT NULL Primary Key is a unique key identifier of the record Unique Key: Can be more than one unique key in one table Unique key can have null values It can be a candidate key Unique key can be null and may not be unique Unique Key (UK) : It's a column or a group of columns that can identify a uniqueness in a row. Primary Key (PK) : It's  also  a column or group of columns that can identify a uniqueness in a row. So the Primary key is just another name for unique key, but the default implementation in SQL Server is different for Primary and Unique Key. By Default: PK creates a Clustered index and UK creates a Non Clustered Index. PK is not null, but UK allows nulls (Note: By Default) There can only be one and only one PK on a table, but there can be multiple UK's You can override the default implementation depending upon your need.

How can I create a unique constraint on my column in SQL Server?

The UNIQUE constraint ensures that all values in a column are different. Both the UNIQUE and PRIMARY KEY constraints provide a guarantee for uniqueness for a column or set of columns. A PRIMARY KEY constraint automatically has a UNIQUE constraint. However, you can have many UNIQUE constraints per table, but only one PRIMARY KEY constraint per table. CREATE   TABLE  Persons (     ID int  NOT   NULL   UNIQUE ,     LastName varchar( 255 )  NOT   NULL ,     FirstName varchar( 255 ),     Age int ); SQL UNIQUE Constraint on ALTER TABLE ALTER   TABLE  Persons ADD   UNIQUE  (ID);