Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Change PK data length from VARCHAR(18) to VARCHAR(25)

$
0
0

Do techniques exist to change a PK data length? How can change the data length efficiently? This is due to a business rule change, a design to allow end-users to query the database, and not using surrogate keys.

I was planning on using VS 2010 and concurrently opening all affected tables in design mode, changing the data type, clicking "Update", and having VS 2010 deal with dropping/adding PK-FK constraints - but VS 2010 crashes run out of memory.

Since we work in "production", i am uncomfortable deploying my SQL SERVER database project since anther developer added objects to the database that are not in the project... I also cannot create a new project because some of the new objects refer to non-existent objects and the project build fails.

I wanted to "EXECUTE sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT ALL" and alter the datatype in batches, but this does not disable PK-FK constraints.

I have these tools:
SQL Server 2008
VS 2010
VS 2012



Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>