Skip to main content

What is key in Sql Server?

Keys are fields in a table which participate in below activities in RDBMS systems:
  1. To create relationships between two tables.
  2. To maintain uniqueness in a table.
  3. To keep consistent and valid data in database.
  4. Might help in fast data retrieval by facilitating indexes on column(s).
SQL Server supports various types of keys, which are listed below:
  1. Candidate Key
  2. Primary Key
  3. Unique Key
  4. Alternate Key
  5. Composite Key
  6. Super Key
  7. Foreign Key

Comments

Popular posts from this blog

List Controls: List Box and Drop Downlist

ASP.Net provides the controls: drop-down list, list box, radio button list, check box list and bulleted list. These control let a user choose from one or more items from the list. List boxes and drop-down list contain one or more list items. These lists could be loaded either by code or by the ListItem Collection Editor. Basic syntax for list box control: <asp:ListBox ID="ListBox1"        runat="server"        AutoPostBack="True"        OnSelectedIndexChanged="ListBox1_SelectedIndexChanged"> </asp:ListBox> Basic syntax for a drop-down list control: <asp:DropDownList ID="DropDownList1"       runat="server"       AutoPostBack="True"       OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> </asp:DropDownList>

Sql CharIndex Function

The CHARINDEX  function returns the starting position of the specified expression in a character string. Example: Search for "t" in string "DotNetReceipe", and return position: SELECT CHARINDEX( 't' , 'DotNetReceipe' ) AS Position;