Wednesday, April 6, 2011

SQL SERVER – Difference Between Unique Index vs Unique Constraint

References :- http://blog.sqlauthority.com/2007/04/26/sql-server-difference-between-unique-index-vs-unique-constraint/

Unique Index and Unique Constraint are the same. They achieve same goal. SQL Performance is same for both.
Add Unique Constraint
ALTER TABLE dbo.<tablename> ADD CONSTRAINT<namingconventionconstraint> UNIQUE NONCLUSTERED(
<
columnname>
)
ON [PRIMARY]
Add Unique Index
CREATE UNIQUE NONCLUSTERED INDEX<namingconventionconstraint> ON dbo.<tablename>
(
<
columnname>
)
ON [PRIMARY]

There is no difference between Unique Index and Unique Constraint. Even though syntax are different the effect is the same. Unique Constraint creates Unique Index to maintain the constraint to prevent duplicate keys. Unique Index or Primary Key Index are physical structure that maintain uniqueness over some combination of columns across all rows of a table. It is a convenient way to enforce a Unique Constraint for SQL Server.
Reference : Pinal Dave (http://blog.SQLAuthority.com)

Thursday, February 24, 2011

Javascript Enable or Disable control on CheckBox checked

If you want to enable disable asp.net controls on click event of checkbox control then here is the solution.
The solution will work for any control.
What we have to do is, just get the controls to be enable and disabled using getElementById by putting their client id as an argument.


Javascript:-
javascript called by checkbox given below.

CheckBox control calling javascript.