Deleting Data in MSSQL

Vic, this is awesome insight. Thanks so much! -bws



--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@... ~ 734-864-5618 ~
www.advancedphotonix.com



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Vic Drecchio
Sent: Thursday, November 20, 2008 4:31 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Deleting Data in MSSQL



When inserting data (properly) via SQL (I do it all the time), you'll
see triggers on most of the tables that require the
PROGRESS_RECID_IDENT_ AND PROGRESS_RECID columns. These triggers
populate those fields automatically and in the case of other Sequential
population (Like LaborHed/LaborDtl), it will hit the corresponding table
in the database that is prefixed with _SEQT_xxxxxxxx

These tables can be seen with SQL Mgmt Studio. These tables keep track
of the latest ID's used to avoid duplication.

Since they are triggers for INSERTS, they will fire anytime a new record
is inserted automatically and unbeknownst to you. They will
auto-populate those Progress fields.

You'll see triggers on almost every table that handle this. I have also
altered some of my triggers to further auto-populate some UD fields by
going out and selecting values from other tables. I love Vantage SQL
for these reasons.

Always backup prior. Always test in TEST multiple times for every
possible scenario. Play in TEST to see any anomalies. All good? Port
it over to LIVE. Also, I always populate a UD field when I do this so I
can quickly identify "my inserts" and delete if necessary.

Work step-by-step in the Query window and just be careful and you will
be OK.

For us SQL folks, Progress is simply a schema holder, nothing more.
It's a middle man.





[Non-text portions of this message have been removed]
I need to reinitialize the XFileRef and XFileAttach tables to address
some problems with data that I previously loaded via Service Connect.



I've heard from various Epicor folks that it is very bad to modify the
MSSQL data directly and customers have hosed themselves trying to load
data manually into SQL. However from my testing in terms of XFileRef
and XFileAttach I don't see any ill effects from deleting the data
that's in there and starting over. I'm loading the new data via
ServiceConnect. I just need to start with a clean XFileRef table to do
what I want to do.



Thoughts?



-bws



--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@...
<mailto:bspolarich@...> ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>





[Non-text portions of this message have been removed]
You should be OK to truncate those databases. Be careful and do it
first in a test environment.

-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Brian W. Spolarich
Sent: Thursday, November 20, 2008 3:08 PM
To: vantage@yahoogroups.com
Subject: [Vantage] Deleting Data in MSSQL

I need to reinitialize the XFileRef and XFileAttach tables to address
some problems with data that I previously loaded via Service Connect.



I've heard from various Epicor folks that it is very bad to modify the
MSSQL data directly and customers have hosed themselves trying to load
data manually into SQL. However from my testing in terms of XFileRef
and XFileAttach I don't see any ill effects from deleting the data
that's in there and starting over. I'm loading the new data via
ServiceConnect. I just need to start with a clean XFileRef table to do
what I want to do.



Thoughts?



-bws



--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@...
<mailto:bspolarich@...> ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advancedphotonix.com>





[Non-text portions of this message have been removed]


------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must
have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder
and Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links
I would recommend a full backup before you do this just in case you need to
roll back on it.



If you have jobs, quotes, so on and so forth that have attachments you are
going to break all of them and they will no longer work I don't know what
the ramifications of this are.



Also be aware that if you use the truncate command it is non reversible
unlike a delete command. However the truncate command will take a lot less
time to run.



_____

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of
Vic Drecchio
Sent: Thursday, November 20, 2008 3:20 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Deleting Data in MSSQL



You should be OK to truncate those databases. Be careful and do it
first in a test environment.

-----Original Message-----
From: vantage@yahoogroups <mailto:vantage%40yahoogroups.com> .com
[mailto:vantage@yahoogroups <mailto:vantage%40yahoogroups.com> .com] On
Behalf
Of Brian W. Spolarich
Sent: Thursday, November 20, 2008 3:08 PM
To: vantage@yahoogroups <mailto:vantage%40yahoogroups.com> .com
Subject: [Vantage] Deleting Data in MSSQL

I need to reinitialize the XFileRef and XFileAttach tables to address
some problems with data that I previously loaded via Service Connect.

I've heard from various Epicor folks that it is very bad to modify the
MSSQL data directly and customers have hosed themselves trying to load
data manually into SQL. However from my testing in terms of XFileRef
and XFileAttach I don't see any ill effects from deleting the data
that's in there and starting over. I'm loading the new data via
ServiceConnect. I just need to start with a clean XFileRef table to do
what I want to do.

Thoughts?

-bws

--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@advanced <mailto:bspolarich%40advancedphotonix.com> photonix.com
<mailto:bspolarich@advanced <mailto:bspolarich%40advancedphotonix.com>
photonix.com> ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advanced
<http://www.advancedphotonix.com> photonix.com>

[Non-text portions of this message have been removed]

------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must
have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder
and Crystal Reports and other 'goodies', please goto:
http://groups. <http://groups.yahoo.com/group/vantage/files/>
yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups. <http://groups.yahoo.com/group/vantage/messages>
yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups. <http://groups.yahoo.com/group/vantage/linksYahoo>
yahoo.com/group/vantage/linksYahoo! Groups Links



No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.175 / Virus Database: 270.9.8/1801 - Release Date: 11/20/2008
9:11 AM




[Non-text portions of this message have been removed]
In my case the only attachments are the one's I'm interested in
recreating, and I'll take a backup just in case anyways.



My real question is "is there anything that by truncating the tables
I'll somehow break the Progress side of things"? My understanding is
that this is one of the reasons one cannot simply insert data by hand
(because of the PROGRESS_RECID columns).



-bws



--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@... ~ 734-864-5618 ~
www.advancedphotonix.com



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Charlie Wilson
Sent: Thursday, November 20, 2008 3:33 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Deleting Data in MSSQL



I would recommend a full backup before you do this just in case you need
to
roll back on it.

If you have jobs, quotes, so on and so forth that have attachments you
are
going to break all of them and they will no longer work I don't know
what
the ramifications of this are.

Also be aware that if you use the truncate command it is non reversible
unlike a delete command. However the truncate command will take a lot
less
time to run.

_____

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf Of
Vic Drecchio
Sent: Thursday, November 20, 2008 3:20 PM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: RE: [Vantage] Deleting Data in MSSQL

You should be OK to truncate those databases. Be careful and do it
first in a test environment.

-----Original Message-----
From: vantage@yahoogroups <mailto:vantage%40yahoogroups.com> .com
[mailto:vantage@yahoogroups <mailto:vantage%40yahoogroups.com> .com] On
Behalf
Of Brian W. Spolarich
Sent: Thursday, November 20, 2008 3:08 PM
To: vantage@yahoogroups <mailto:vantage%40yahoogroups.com> .com
Subject: [Vantage] Deleting Data in MSSQL

I need to reinitialize the XFileRef and XFileAttach tables to address
some problems with data that I previously loaded via Service Connect.

I've heard from various Epicor folks that it is very bad to modify the
MSSQL data directly and customers have hosed themselves trying to load
data manually into SQL. However from my testing in terms of XFileRef
and XFileAttach I don't see any ill effects from deleting the data
that's in there and starting over. I'm loading the new data via
ServiceConnect. I just need to start with a clean XFileRef table to do
what I want to do.

Thoughts?

-bws

--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@advanced <mailto:bspolarich%40advancedphotonix.com>
photonix.com
<mailto:bspolarich@advanced <mailto:bspolarich%40advancedphotonix.com>
photonix.com> ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advanced
<http://www.advancedphotonix.com> photonix.com>

[Non-text portions of this message have been removed]

------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must
have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder
and Crystal Reports and other 'goodies', please goto:
http://groups. <http://groups.yahoo.com/group/vantage/files/>
yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups. <http://groups.yahoo.com/group/vantage/messages>
yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups. <http://groups.yahoo.com/group/vantage/linksYahoo>
yahoo.com/group/vantage/linksYahoo! Groups Links

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.175 / Virus Database: 270.9.8/1801 - Release Date:
11/20/2008
9:11 AM

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]
When inserting data (properly) via SQL (I do it all the time), you'll
see triggers on most of the tables that require the
PROGRESS_RECID_IDENT_ AND PROGRESS_RECID columns. These triggers
populate those fields automatically and in the case of other Sequential
population (Like LaborHed/LaborDtl), it will hit the corresponding table
in the database that is prefixed with _SEQT_xxxxxxxx

These tables can be seen with SQL Mgmt Studio. These tables keep track
of the latest ID's used to avoid duplication.

Since they are triggers for INSERTS, they will fire anytime a new record
is inserted automatically and unbeknownst to you. They will
auto-populate those Progress fields.

You'll see triggers on almost every table that handle this. I have also
altered some of my triggers to further auto-populate some UD fields by
going out and selecting values from other tables. I love Vantage SQL
for these reasons.

Always backup prior. Always test in TEST multiple times for every
possible scenario. Play in TEST to see any anomalies. All good? Port
it over to LIVE. Also, I always populate a UD field when I do this so I
can quickly identify "my inserts" and delete if necessary.

Work step-by-step in the Query window and just be careful and you will
be OK.

For us SQL folks, Progress is simply a schema holder, nothing more.
It's a middle man.

Here's an example of a trigger on the POHeader table.

/* Trigger to increment the ROWID field and update
* any case insensitive columns when a record is inserted.
* 2005 rewrote trigger per Progress documentation.
*/
ALTER trigger [_ti_poheader] ON [dbo].[poheader] for insert as
begin
if ( select PROGRESS_RECID from inserted) is NULL
begin
update t set PROGRESS_RECID = i.IDENTITYCOL
from poheader t JOIN INSERTED i ON
t.PROGRESS_RECID_IDENT_ = i.PROGRESS_RECID_IDENT_
select convert (bigint, @@identity)
end
end




-----Original Message-----
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Brian W. Spolarich
Sent: Thursday, November 20, 2008 4:06 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Deleting Data in MSSQL

In my case the only attachments are the one's I'm interested in
recreating, and I'll take a backup just in case anyways.



My real question is "is there anything that by truncating the tables
I'll somehow break the Progress side of things"? My understanding is
that this is one of the reasons one cannot simply insert data by hand
(because of the PROGRESS_RECID columns).



-bws



--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@... ~ 734-864-5618 ~
www.advancedphotonix.com



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Charlie Wilson
Sent: Thursday, November 20, 2008 3:33 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Deleting Data in MSSQL



I would recommend a full backup before you do this just in case you need
to
roll back on it.

If you have jobs, quotes, so on and so forth that have attachments you
are
going to break all of them and they will no longer work I don't know
what
the ramifications of this are.

Also be aware that if you use the truncate command it is non reversible
unlike a delete command. However the truncate command will take a lot
less
time to run.

_____

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
[mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On
Behalf Of
Vic Drecchio
Sent: Thursday, November 20, 2008 3:20 PM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: RE: [Vantage] Deleting Data in MSSQL

You should be OK to truncate those databases. Be careful and do it
first in a test environment.

-----Original Message-----
From: vantage@yahoogroups <mailto:vantage%40yahoogroups.com> .com
[mailto:vantage@yahoogroups <mailto:vantage%40yahoogroups.com> .com] On
Behalf
Of Brian W. Spolarich
Sent: Thursday, November 20, 2008 3:08 PM
To: vantage@yahoogroups <mailto:vantage%40yahoogroups.com> .com
Subject: [Vantage] Deleting Data in MSSQL

I need to reinitialize the XFileRef and XFileAttach tables to address
some problems with data that I previously loaded via Service Connect.

I've heard from various Epicor folks that it is very bad to modify the
MSSQL data directly and customers have hosed themselves trying to load
data manually into SQL. However from my testing in terms of XFileRef
and XFileAttach I don't see any ill effects from deleting the data
that's in there and starting over. I'm loading the new data via
ServiceConnect. I just need to start with a clean XFileRef table to do
what I want to do.

Thoughts?

-bws

--

Brian W. Spolarich ~ Manager, Information Services ~ Advanced Photonix /
Picometrix

bspolarich@advanced <mailto:bspolarich%40advancedphotonix.com>
photonix.com
<mailto:bspolarich@advanced <mailto:bspolarich%40advancedphotonix.com>
photonix.com> ~ 734-864-5618 ~
www.advancedphotonix.com <http://www.advanced
<http://www.advancedphotonix.com> photonix.com>

[Non-text portions of this message have been removed]

------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must
have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder
and Crystal Reports and other 'goodies', please goto:
http://groups. <http://groups.yahoo.com/group/vantage/files/>
yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups. <http://groups.yahoo.com/group/vantage/messages>
yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups. <http://groups.yahoo.com/group/vantage/linksYahoo>
yahoo.com/group/vantage/linksYahoo! Groups Links

No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.175 / Virus Database: 270.9.8/1801 - Release Date:
11/20/2008
9:11 AM

[Non-text portions of this message have been removed]





[Non-text portions of this message have been removed]


------------------------------------

Useful links for the Yahoo!Groups Vantage Board are: ( Note: You must
have already linked your email address to a yahoo id to enable access. )
(1) To access the Files Section of our Yahoo!Group for Report Builder
and Crystal Reports and other 'goodies', please goto:
http://groups.yahoo.com/group/vantage/files/.
(2) To search through old msg's goto:
http://groups.yahoo.com/group/vantage/messages
(3) To view links to Vendors that provide Vantage services goto:
http://groups.yahoo.com/group/vantage/linksYahoo! Groups Links