Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
I'm surprised about the zero byte file. I tried it on one of my dbc's and it worked fine; did you have the dbc open?
Laurie
On 13 June 2016 at 13:23, Fernando D. Bozzo fdbozzo@gmail.com wrote:
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
The table trigger code isn't a stored procedure.
Hi Dave, did you solve the problem? How ? El 13/6/2016 14:23, "Fernando D. Bozzo" fdbozzo@gmail.com escribió:
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
Fernando, Yes I did but had to resort to copying the Property field out of every record in the old DBC container wher the ObjectType was set to "TABLE" i.e. the actual triggers themselves. I did this as a separate event after loading up the new DBC table with the old records and it works well.
I couldn't find any way of doing it without hacking the DBC unfortunately, but it works and that is the main result.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Fernando D. Bozzo Sent: 15 June 2016 11:54 To: ProFox Email List profox@leafe.com Subject: RE: Copying Triggers
Hi Dave, did you solve the problem? How ? El 13/6/2016 14:23, "Fernando D. Bozzo" fdbozzo@gmail.com escribió:
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
_______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/CAGQ_Jum8RD4YEhtD8WPLEp+E4sNoi_gGeaDu... ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
So you didn't see the foxbin way of doing it text. It's a pity that you haven't tried that. El 15/6/2016 12:57, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Fernando, Yes I did but had to resort to copying the Property field out of every record in the old DBC container wher the ObjectType was set to "TABLE" i.e. the actual triggers themselves. I did this as a separate event after loading up the new DBC table with the old records and it works well.
I couldn't find any way of doing it without hacking the DBC unfortunately, but it works and that is the main result.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Fernando D. Bozzo Sent: 15 June 2016 11:54 To: ProFox Email List profox@leafe.com Subject: RE: Copying Triggers
Hi Dave, did you solve the problem? How ? El 13/6/2016 14:23, "Fernando D. Bozzo" fdbozzo@gmail.com escribió:
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
Fernando, I did see your post and I will try it later when I have time but I needed the solution straight away and the DBC method I knew would work. In addition the program runs 24/7 and would have needed a fair amount of customisation to incorporate your idea. Thank you all the same.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Fernando D. Bozzo Sent: 15 June 2016 12:27 To: ProFox Email List profox@leafe.com Subject: RE: Copying Triggers
So you didn't see the foxbin way of doing it text. It's a pity that you haven't tried that. El 15/6/2016 12:57, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Fernando, Yes I did but had to resort to copying the Property field out of every record in the old DBC container wher the ObjectType was set to "TABLE" i.e. the actual triggers themselves. I did this as a separate event after loading up the new DBC table with the old records and it works well.
I couldn't find any way of doing it without hacking the DBC unfortunately, but it works and that is the main result.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Fernando D. Bozzo Sent: 15 June 2016 11:54 To: ProFox Email List profox@leafe.com Subject: RE: Copying Triggers
Hi Dave, did you solve the problem? How ? El 13/6/2016 14:23, "Fernando D. Bozzo" fdbozzo@gmail.com escribió:
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
_______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/CAGQ_JumZZjUdEUc2AwzYZd2Le+Lb2Fej5uSk... ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
The whole thing sounds like a hack.
When you script out a table you don't get all of the table object such as indexes, constraints, triggers, and keys?
On Wed, Jun 15, 2016 at 5:56 AM, Dave Crozier DaveC@flexipol.co.uk wrote:
Fernando, Yes I did but had to resort to copying the Property field out of every record in the old DBC container wher the ObjectType was set to "TABLE" i.e. the actual triggers themselves. I did this as a separate event after loading up the new DBC table with the old records and it works well.
I couldn't find any way of doing it without hacking the DBC unfortunately, but it works and that is the main result.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Fernando D. Bozzo Sent: 15 June 2016 11:54 To: ProFox Email List profox@leafe.com Subject: RE: Copying Triggers
Hi Dave, did you solve the problem? How ? El 13/6/2016 14:23, "Fernando D. Bozzo" fdbozzo@gmail.com escribió:
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
Stephen, Copy structure extended gives you the triggers un the fields Ins_Trig, Upd_Trig and Del_Trg but this is messy as you have to copy out to a database table which is counter intuitive as the whole reason for doing this was to copy the database.
Unfortunately you can't script out the VFP tables like in M$SQL unless you do it my way or you could use aFields() but I have foundthis to be very, very slow and inconsistent on getting the Triggers correctly!
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Stephen Russell Sent: 15 June 2016 14:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
The whole thing sounds like a hack.
When you script out a table you don't get all of the table object such as indexes, constraints, triggers, and keys?
On Wed, Jun 15, 2016 at 5:56 AM, Dave Crozier DaveC@flexipol.co.uk wrote:
Fernando, Yes I did but had to resort to copying the Property field out of every record in the old DBC container wher the ObjectType was set to "TABLE" i.e. the actual triggers themselves. I did this as a separate event after loading up the new DBC table with the old records and it works well.
I couldn't find any way of doing it without hacking the DBC unfortunately, but it works and that is the main result.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Fernando D. Bozzo Sent: 15 June 2016 11:54 To: ProFox Email List profox@leafe.com Subject: RE: Copying Triggers
Hi Dave, did you solve the problem? How ? El 13/6/2016 14:23, "Fernando D. Bozzo" fdbozzo@gmail.com escribió:
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated (Insert/Update and Delete).
Dave
[excessive quoting removed by server]
_______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/CAJidMYKEbO4-ate7ja=KPDZbM7wrOFD9wT+o... ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.
Dave, this is what exactly does FoxBin2Prg when you export to text DBCs and DBFs, having all those indexes, triggers, stored procedures and more in plain text, so you can copy/past/adapt what you need to another DB2, so when regenerating the new DBC and DBF all is there.
2 input text files and 1 destination in the case of DBC change
Before I gave this solution I've made a test myself with a copy of some tables from our system, to certify that could be made in 10 minutes. El 15/6/2016 16:04, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Stephen, Copy structure extended gives you the triggers un the fields Ins_Trig, Upd_Trig and Del_Trg but this is messy as you have to copy out to a database table which is counter intuitive as the whole reason for doing this was to copy the database.
Unfortunately you can't script out the VFP tables like in M$SQL unless you do it my way or you could use aFields() but I have foundthis to be very, very slow and inconsistent on getting the Triggers correctly!
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Stephen Russell Sent: 15 June 2016 14:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
The whole thing sounds like a hack.
When you script out a table you don't get all of the table object such as indexes, constraints, triggers, and keys?
On Wed, Jun 15, 2016 at 5:56 AM, Dave Crozier DaveC@flexipol.co.uk wrote:
Fernando, Yes I did but had to resort to copying the Property field out of every record in the old DBC container wher the ObjectType was set to "TABLE"
i.e.
the actual triggers themselves. I did this as a separate event after loading up the new DBC table with the old records and it works well.
I couldn't find any way of doing it without hacking the DBC unfortunately, but it works and that is the main result.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Fernando D. Bozzo Sent: 15 June 2016 11:54 To: ProFox Email List profox@leafe.com Subject: RE: Copying Triggers
Hi Dave, did you solve the problem? How ? El 13/6/2016 14:23, "Fernando D. Bozzo" fdbozzo@gmail.com escribió:
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated
(Insert/Update and Delete).
Dave
[excessive quoting removed by server]
This is the scary part for me. "very slow and* inconsistent on getting the Triggers correctly!"*
The dbc only has code to do everything that it does. Why would one trigger come out properly and another not, because it is all code? Unless you are mixing up SQL code from old VFP functions maybe?
Either way not getting the proper output would scare me about how it is operating.
On Wed, Jun 15, 2016 at 9:03 AM, Dave Crozier DaveC@flexipol.co.uk wrote:
Stephen, Copy structure extended gives you the triggers un the fields Ins_Trig, Upd_Trig and Del_Trg but this is messy as you have to copy out to a database table which is counter intuitive as the whole reason for doing this was to copy the database.
Unfortunately you can't script out the VFP tables like in M$SQL unless you do it my way or you could use aFields() but I have foundthis to be very, very slow and inconsistent on getting the Triggers correctly!
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Stephen Russell Sent: 15 June 2016 14:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
The whole thing sounds like a hack.
When you script out a table you don't get all of the table object such as indexes, constraints, triggers, and keys?
On Wed, Jun 15, 2016 at 5:56 AM, Dave Crozier DaveC@flexipol.co.uk wrote:
Fernando, Yes I did but had to resort to copying the Property field out of every record in the old DBC container wher the ObjectType was set to "TABLE"
i.e.
the actual triggers themselves. I did this as a separate event after loading up the new DBC table with the old records and it works well.
I couldn't find any way of doing it without hacking the DBC unfortunately, but it works and that is the main result.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Fernando D. Bozzo Sent: 15 June 2016 11:54 To: ProFox Email List profox@leafe.com Subject: RE: Copying Triggers
Hi Dave, did you solve the problem? How ? El 13/6/2016 14:23, "Fernando D. Bozzo" fdbozzo@gmail.com escribió:
Hi Dave:
You can use FoxBin2Prg for that. Just need to copy/change the metadata in plain text and regenerate your DBC and DBF
I think that it's easier to look and change 2 plain text files than fight with a lot of functions.
Best Regards.-
El 13/6/2016 12:38, "Dave Crozier" DaveC@flexipol.co.uk escribió:
Laurie, Thought you'd cracked it there but the copy procedures command does nothing at all, simply creates a zero byte file. Alan's solution works so I'll go with that and check each table for all triggers. The program I am amending is a constant DBC backup program that has been working for years but never had to bother with triggers before!
Thanks guys.
Dave
-----Original Message----- From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Laurie Alvey Sent: 13 June 2016 11:22 To: ProFox Email List profox@leafe.com Subject: Re: Copying Triggers
Have you looked at COPY PROCEDURES TO <filename> followed by APPEND PROCEDURES FROM <filename>? With a bit of editing of the output file, it might do what you want.
Laurie
On 13 June 2016 at 10:11, Dave Crozier DaveC@flexipol.co.uk wrote:
Ladies and Gentlemen, Anyone know if there is a way to copy triggers over to a new table without having to enquire into the DBC container?
I have found that the triggers are held against each table in the DBC in the record with "objectname field" set to the name of the table, being held in the table "Property field" (Memo) so you can get at the contents of the triggers but I don't really want to have to do this if there is a table copy command or equivalent that does it for you. I am not simply being lazy here as copying this memo field over using scatter/gather doesn't always seem to transfer the correct trigger info over into the destination table.
We have recently started making use of triggers to automatically insert records into a M$ table mirror of the VFP Table to aid in converting over from VFP tables to M$ SQL tables and the inability to copy triggers over has bit me in the proverbial "ass". We have a small tag call to a SQL master object that updates the SQL table whenever the VFP base table is updated
(Insert/Update and Delete).
Dave
[excessive quoting removed by server]
DbGetProp(MyTable, "TABLE", "DeleteTrigger") will return the delete trigger info for the table 'MyTable'.
'UpdateTrigger' and 'InsertTrigger' work the same way.
So presumably:
Create trigger on myothertable for insert as DbGetProp(MyTable, "TABLE", "InsertTrigger")
would work.
Alan's solution is much better than mine!
Laurie
On 13 June 2016 at 11:24, Alan Bourke alanpbourke@fastmail.fm wrote:
So presumably:
Create trigger on myothertable for insert as DbGetProp(MyTable, "TABLE", "InsertTrigger")
would work.
-- Alan Bourke alanpbourke (at) fastmail (dot) fm
[excessive quoting removed by server]