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 | 506 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: SQLServerCentral.com | Category: foreign keys (fk)
Rating: |  Discuss |   Briefcase | 3,863 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: SQLServerCentral.com | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,878 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: SQLServerCentral.com | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,387 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: SQLServerCentral.com | Category: foreign keys (fk)
Rating: |  Discuss |   Briefcase | 1,123 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: SQLServerCentral.com | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 839 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: SQLServerCentral.com | 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: SQLServerCentral.com | Category: foreign keys (fk)
Rating: |  Discuss |   Briefcase | 1,538 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: SQLServerCentral.com | 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: SQLServerCentral.com | Category: rename primary key
Rating: |  Discuss |   Briefcase | 1,659 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: SQLServerCentral.com | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,543 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: SQLServerCentral.com | 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: SQLServerCentral.com | 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: SQLServerCentral.com | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,241 reads

Generate Insert Statements

This script Generates the insert statements for a particular table.  Read more...
By Vinay Kumar 2008/11/04 | Source: SQLServerCentral.com | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,900 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: SQLServerCentral.com
Rating: (not yet rated) |  Discuss |   Briefcase | 930 reads
   Items 1 to 16 of 16