Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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 13 of 13   
 

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 Dedhia 2012/10/02 | Source: SQLServerCentral.com | Category: primary key (pk)
Rating: |  Discuss |   Briefcase | 1,334 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 | 949 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 | 806 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 | 891 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,481 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,240 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,632 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,476 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 | 642 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,265 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,213 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,752 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 | 885 reads
   Items 1 to 13 of 13