﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Creating PK / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 20 Jun 2013 05:08:04 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Creating PK</title><link>http://www.sqlservercentral.com/Forums/Topic865903-391-1.aspx</link><description>Check if you have an unique index on empid column...if yes then build your PK on it.if no then check for and fix empid duplicates then build your PK on it.</description><pubDate>Tue, 16 Feb 2010 05:26:34 GMT</pubDate><dc:creator>PaulB-TheOneAndOnly</dc:creator></item><item><title>RE: Creating PK</title><link>http://www.sqlservercentral.com/Forums/Topic865903-391-1.aspx</link><description>[quote][b]luckysql.kinda (2/16/2010)[/b][hr]Following is the empdetails table in my organization which has been used for last 3 years.create table Empdetails(empid int , empname varchar)We noticed that there was no primary key and now we are looking for transactional replication to replicate this data. How can I create primary key on this table. According to my understanding the primary key can be created only when the table is created. Do I need to create a dummy table and then transferring data, rename this table as Empdetails after dropping the original table?-Lk[/quote]ALTER TABLE Empdetails ADD CONSTRAINT PK_Empdetails PRIMARY KEY ....Refer BOL for more information.</description><pubDate>Tue, 16 Feb 2010 05:10:27 GMT</pubDate><dc:creator>Suresh B.</dc:creator></item><item><title>Creating PK</title><link>http://www.sqlservercentral.com/Forums/Topic865903-391-1.aspx</link><description>Following is the empdetails table in my organization which has been used for last 3 years.create table Empdetails(empid int , empname varchar)We noticed that there was no primary key and now we are looking for transactional replication to replicate this data. How can I create primary key on this table. According to my understanding the primary key can be created only when the table is created. Do I need to create a dummy table and then transferring data, rename this table as Empdetails after dropping the original table?-Lk</description><pubDate>Tue, 16 Feb 2010 02:08:50 GMT</pubDate><dc:creator>luckysql.kinda</dc:creator></item></channel></rss>