Results 1 to 5 of 5

Thread: Scripting help

  1. #1
    Join Date
    Jul 2004
    Posts
    191

    Unanswered: Scripting help

    I have to come up a script that will be going across 60 different servers that will be looking for document type that are not being used across all servers and then deleting them.

    To start with:

    Select Enabled from MHGROUP.CUSTOM5
    where Enabled ='N'

    then delete records

    and where would I run this type of script or should I say can this be done?

    Thanks

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Document type?

    You need to explain more clearly if you want assistance.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Jul 2004
    Posts
    191
    In all of the 60 servers/database the table CUSTOM5 exist. This table is a lookup table that tell you which document types are being used. there is a field call Enabled which is a yes/no field. So by this field I am only interested in the value "N" so in one database I would need to get a list of all the document type that are disabled and compare them with the other servers and then I will delete only the document type that are not being used across every server. So even if in one database a document type is disabled I will only delete that record when all of the databases are not using that document type.

    I hope that helps.

    THanks

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Ugh. 60 servers is a lot. I hope you don't have to run this too often.

    My approach would be to select the document types (both used and unused) from all 60 servers into a central table and then run a query against that table.
    I would NOT try writing a query that linked tables across 60 servers.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Jul 2004
    Posts
    191
    select CUSTOM_ALIAS, C_DESCRIPT, ENABLED from MHGROUP.CUSTOM5 where NOT exists(select C5ALIAS from MHGROUP.DOCMASTER
    where MHGROUP.CUSTOM5.CUSTOM_ALIAS=MHGROUP.DOCMASTER.C5A LIAS)

    From this query I was able to see what document types are not being used, so I would need to take that list and import it in to a central table. How would I go about doing this.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •