I need to transfer the data collected by two Forms from the current database into a new database. The new database does not have any Forms data, however I need to keep the current record ID values - as they have been used as a key for returning visitors to open up their submitted data :-(
I am assuming I will need to do this as a SQL script, to turn off identity insert, etc but I was just wondering if anyone had just happened to have done it already and had a ready prepared script!!
Is all of the Forms data limited to the tables beginning with "UF"?
Hi Mark, I have created an SQL script to copy the contents of specific tables.
USE Umbraco74
-- Copy Forms data from the current database (Umbraco72) into the new database (Umbraco74)
-- UFRecords
-- Allow insert of Identity values
SET IDENTITY_INSERT UFRecords ON
INSERT INTO UFRecords ([Id], [Form], [Created], [Updated], [CurrentPage], [UmbracoPageId], [IP], [MemberKey], [UniqueId], [State], [RecordData])
SELECT [Id], [Form], [Created], [Updated], [CurrentPage], [UmbracoPageId], [IP], [MemberKey], [UniqueId], [State], [RecordData]
FROM Umbraco72.dbo.UFRecords
SET IDENTITY_INSERT UFRecords OFF
-- UFRecordFields
INSERT INTO UFRecordFields ([Key], [FieldId], [Record], [Alias], [DataType])
SELECT [Key], [FieldId], [Record], [Alias], [DataType]
FROM Umbraco72.dbo.UFRecordFields
-- UFRecordDataString
SET IDENTITY_Insert UFRecordDataString ON
INSERT INTO UFRecordDataString ([Id], [Key], [Value])
SELECT [Id], [Key], [Value]
FROM Umbraco72.dbo.UFRecordDataString
SET IDENTITY_Insert UFRecordDataString OFF
-- UFRecordDataString
SET IDENTITY_Insert UFRecordDataLongString ON
INSERT INTO UFRecordDataLongString ([Id], [Key], [Value])
SELECT [Id], [Key], [Value]
FROM Umbraco72.dbo.UFRecordDataLongString
SET IDENTITY_Insert UFRecordDataLongString OFF
There are other "UF" tables that you may also need to add, if they have any content in them.
It goes without saying that you should make a backup of both databases before trying this script. Also, note that this works on the basis that there are NO existing records in the destination database. Finally, please note that although I have run this a few times, I have not done extensive testing to ensure nothing has gone wrong! (phew, end of the T&C's!!!)
Copy Forms data from one DB to another
I need to transfer the data collected by two Forms from the current database into a new database. The new database does not have any Forms data, however I need to keep the current record ID values - as they have been used as a key for returning visitors to open up their submitted data :-(
I am assuming I will need to do this as a SQL script, to turn off identity insert, etc but I was just wondering if anyone had just happened to have done it already and had a ready prepared script!!
Is all of the Forms data limited to the tables beginning with "UF"?
Can I add a me too to this.. It's something I know will be coming up in the near future for one of my sites..
Gordon, if you figure it out and it's nice and easy, would be great to hear exactly what you needed to do :-)
Cheers,
Mark
Hi Mark, I have created an SQL script to copy the contents of specific tables.
There are other "UF" tables that you may also need to add, if they have any content in them.
It goes without saying that you should make a backup of both databases before trying this script. Also, note that this works on the basis that there are NO existing records in the destination database. Finally, please note that although I have run this a few times, I have not done extensive testing to ensure nothing has gone wrong! (phew, end of the T&C's!!!)
Could this work with Umbraco 8...
Is there another way to do it the latest version?
is working on a reply...