Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Scripts with tag Primary Key (PK) Rss

Search for any content tagged primary key (pk)

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Add a script

   Items 1 to 16 of 16   

Procedure to Find Candidate Keys

This Procedure will Display all the keys in a Specified Table   Read more...
Rating: |  Discuss |   Briefcase | 82 reads

List Table Foreign Keys, Primary key and indexes

This procedure let you list [optional] by table: -Foreign keys -Primary key -Indexes   Read more...
By Martin Collazos 2015/03/27 | Source: | Category: foreign key list
Rating: |  Discuss |   Briefcase | 3,860 reads

Primary Keys which are not Clustered Indexes in a database

Recently I was asked to find all the Primary keys that are not clustered Indexes in the database. I constructed the below script which will help us to locate the primary keys in the database which are not clustered index.  Read more...
By Bodhisatya Mookherjee 2013/09/18 | Source: | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,874 reads

Find Primary Column of all tables in database

This code helps in finding Primary Keys for all tables in a database.  Read more...
By Nitesh R Dedhia 2012/10/02 | Source: | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,385 reads

Check if Constraint is enabled or disabled

This is a script to find all constraints and check if they are enabled or disabled.  Read more...
By roberto armellin 2011/11/03 | Source: | Category: foreign keys (fk)
Rating: |  Discuss |   Briefcase | 1,106 reads

Find gaps in primary keys across multiple databases

Output table of gaps in a primary key across multiple databases on same, remote and/or linked servers.  Read more...
By Richard White 2011/08/29 | Source: | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 838 reads

proc to change PK

This script was created for a client who had uniqueidentifier PKs, but wanted to switch to BIGINT IDENTITY PK for better db performance.  Read more...
By colin_sloss 2011/03/24 | Source: | Category: primary key (pk)
Rating: (not yet rated) |  Discuss |   Briefcase | 896 reads

Columns Explorer - With constraints create / drop scripts (no cursors)

Gets all columns infos, foreign keys (multicolumn fk handled), referenced primary keys, default and check constraints, indexes, Create/Drop scripts for all constraints.  Read more...
By antonio cuna 2011/02/28 | Source: | Category: foreign keys (fk)
Rating: |  Discuss |   Briefcase | 1,534 reads

Stored procedure to script tables, has many options

I needed a fast way of creating identical copies of multiple tables. The criteria was to make identical copies of tables for a specific schema. Well there it started.  Read more...
By Gokhan Varol 2011/02/01 | Source: | Category: t-sql
Rating: (not yet rated) |  Discuss |   Briefcase | 2,284 reads

Changing Primary key names to standard naming convention across the DB

This script will rename the Primary keys to standard notation - PK_TableName  Read more...
By Vidyadhar Pandekar 2011/07/29 | Source: | Category: rename primary key
Rating: |  Discuss |   Briefcase | 1,658 reads

Find Foreign Key Tables

an easy method to find foreign key tables from primary key table  Read more...
By Jason S Wong 2009/10/27 | Source: | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,541 reads

Create/ drop unique key

This script will show you how to create/ drop unique key.  Read more...
By Michaƫl Hardman 2009/09/24 | Source: | Category: create
Rating: |  Discuss |   Briefcase | 658 reads

how get primary key in any database

drop the primary key name is different for each database  Read more...
By Furanshizuku 2009/01/29 | Source: | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,284 reads

Getting unique or primary key columns for a given table

Following script will list out all the columns which have unique/primary key constraints for a given table.  Read more...
By Kiran Kumar 2009/01/02 | Source: | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,240 reads

Generate Insert Statements

This script Generates the insert statements for a particular table.  Read more...
By Vinay Kumar 2008/11/04 | Source: | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,896 reads

Add Primary key

This Store procedure is used to add primary key to all tables in a database, if table does not contain it.  Read more...
By Vinay Kumar 2008/11/04 | Source:
Rating: (not yet rated) |  Discuss |   Briefcase | 930 reads
   Items 1 to 16 of 16