Extracting Fault Cuts directly from the database, Kingdom SQL

I have come into a situation where a Geologist names his fault cuts as the throw of the fault cut. This was done as a workaround to enable posting both depth and throw on vertical sections. But the unintended consequence is that there may be multiple fault cuts in a single well with the same name. The spreadsheet function in Kingdom will only display one of the fault cuts when this happens. So I turn to the SQL database to extract the fault cuts manually. Below is the SQL query that will pull API, Author, Fault Cut Name, Fault Cut Depth, Fault Cut Throw, Borehole Name, Well Name, and Well Number from the database.

** this SQL command will only pull fault cuts that have a throw. If throw is not entered for a fault cut, it will be ignored.

SELECT
dbo.T000000_T_Borehole.Uwi as “API”,
dbo.T000000_T_Author.Name as “Author”,
dbo.T000000_T_AuthoredName.name as “Name”,
dbo.T000000_T_SurfacePick.PickDepth,
dbo.T000000_T_SurfacePick.CustomData as “Throw”,
dbo.T000000_T_Borehole.Name as “Borehole Name”,
dbo.T000000_T_Well.Name as “Well Name”,
dbo.T000000_T_Well.WellNumber
FROM dbo.T000000_T_SurfacePick
inner join dbo.T000000_T_Author on dbo.T000000_T_Author.ID = dbo.T000000_T_SurfacePick.OwningAuthorID
inner join dbo.T000000_T_AuthoredName on dbo.T000000_T_AuthoredName.ID = dbo.T000000_T_SurfacePick.AuthoredNameID
inner join dbo.T000000_T_Borehole on dbo.T000000_T_Borehole.ID = dbo.T000000_T_SurfacePick.BoreholeID
inner join dbo.T000000_T_Well on dbo.T000000_T_Borehole.WellID = dbo.T000000_T_Well.ID
WHERE dbo.T000000_T_SurfacePick.CustomData > 0
order by dbo.T000000_T_Borehole.Uwi, dbo.T000000_T_SurfacePick.PickDepth
;

 

2 thoughts on “Extracting Fault Cuts directly from the database, Kingdom SQL

  1. LauraR

    Thanks for this. I’m just getting into using sql with Kingdom and my first query was to pull tops. This helped tons.

    Thanks!

    Reply
  2. Dennis Bourn Post author

    Im glad you found some use for it. This is the SQL query I use to pull tops. I have to go to the database to get the top and quality in a format that can then be imported into another project.

    select
    dbo.T000000_T_Author.Name as “Author”,
    dbo.T000000_T_AuthoredName.Name as “Name”,
    dbo.T000000_T_AuthoredName.Abbreviation as “Abbreviation”,
    dbo.T000000_T_SurfacePick.PickDepth,
    dbo.T000000_T_Borehole.Uwi as “API”,
    dbo.T000000_T_Name.Name as “Quality Abbr”,
    dbo.T000000_T_Name.Abbreviation as “Quality Name”
    from dbo.T000000_T_SurfacePick
    inner join dbo.T000000_T_Author on dbo.T000000_T_Author.ID = dbo.T000000_T_SurfacePick.OwningAuthorID
    inner join dbo.T000000_T_AuthoredName on dbo.T000000_T_AuthoredName.ID = dbo.T000000_T_SurfacePick.AuthoredNameID
    inner join dbo.T000000_T_Borehole on dbo.T000000_T_Borehole.ID = dbo.T000000_T_SurfacePick.BoreholeID
    left outer join dbo.T000000_T_Name on dbo.T000000_T_Name.ID = dbo.T000000_T_SurfacePick.QualityID
    where
    dbo.T000000_T_Author.Name = ‘DRB’ and
    dbo.T000000_T_SurfacePick.CustomData < 1 ; Replace 'DRB' in the second to last line with the name of the author you want to export.

    Reply

Leave a Reply

Your email address will not be published.