Ask a Question related to Coldfusion Database Access, Design and Development.
-
dj shane #1
Preserving Primary Keys in DTS
I have a dev and production server. I want to copy the data from a table in production to DEV and preserve the primary key values. What's the best way to do this? DTS kills the keys.
dj shane Guest
-
Autoincremented id with two primary keys
Hi all. I have this table: CREATE TABLE sites_pages ( id int(6) NOT NULL, site_id int(4) NOT NULL, name varchar(80) NOT NULL, UNIQUE KEY... -
CFWDDX not preserving case on keys
Using MX 6.1, I'm serializing a structure to Javascript and the key names are being converted to lowercase. According to the MM docs, WDDX preserves... -
Tablespaces and primary keys
Implicit indexes created by a constraint do not appear to honor the default tablespace. The index gets created in the "null" tablespace. I took... -
Deleting Primary Keys
Can describe how to drop a primary key from a table? Thanks, Don Bryant -
Primary Keys
How is it that even though I have the column "username" in my database set as a Primary key, using my PHP script to add new users to the database... -
SQLMenace #2
Re: Preserving Primary Keys in DTS
I assume you are talking about an identity field
disable the identity field
then run
SET IDENTITY_INSERT TableName ON
run your insert
after insert set it to off
SET IDENTITY_INSERT TableName OFF
Make the field and identity again
[url]http://sqlservercode.blogspot.com/[/url]
SQLMenace Guest
-
dj shane #3
Re: Preserving Primary Keys in DTS
SQLMenace,
Will this actually preserve the values I had in the table? They are out of order right now because rows were removed, etc. I'd like to preserve all that. Thanks for your help.
dj shane Guest
-
SQLMenace #4
Re: Preserving Primary Keys in DTS
Actually you don't need to disable the identity filed if you use SET
IDENTITY_INSERT TableName ON
Anyway the values will be preserved
This is what you do 1:
the field is an identity
SET IDENTITY_INSERT TableName ON
run your insert
after insert set it to off
SET IDENTITY_INSERT TableName OFF
2
the field is not an identity
run your insert
Make the field an identity
That should do it
SQLMenace Guest



Reply With Quote

