Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Create constraints for lastname, firstname and middlename

Create constraints for lastname, firstname and middlename

Scheduled Pinned Locked Moved Database
questiondatabasesql-serversysadminhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Yosh_
    wrote on last edited by
    #1

    Hi guys, i'm kinda new in using MSSQL. I'm using MSSQL Server 2005. I've created the primary key on a field that auto generates. However, i need to disallow the same name inputed again. I think i might have to write a t-sql statement on the table. But i really don't know how to go about it. Pls help. How can i achieve this?

    He who goes for revenge must first dig two graves.

    L 1 Reply Last reply
    0
    • Y Yosh_

      Hi guys, i'm kinda new in using MSSQL. I'm using MSSQL Server 2005. I've created the primary key on a field that auto generates. However, i need to disallow the same name inputed again. I think i might have to write a t-sql statement on the table. But i really don't know how to go about it. Pls help. How can i achieve this?

      He who goes for revenge must first dig two graves.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Creamboy wrote:

      However, i need to disallow the same name inputed again.

      That would be a Unique Constraint, somewhat similar to this example;

      ALTER TABLE [MyTable]
      ADD CONSTRAINT [UniqueConstraintName]
      UNIQUE (ColumnValue)

      I are Troll :suss:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups