
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
;

For over two decades, Dennis Bourn and the team at Bourn Technology have been helping engineering firms, law practices and many other businesses across New Orleans and the surrounding areas get the most from the technology they value so much. To find out more information about what the right MSP can bring to the table, or to learn more about aligning your IT with your long-term goals as a business, please don’t delay – contact Bourn Technology today.
2 Comments
Leave a Comment
Stay in the Know
Subscribe to our email newsletter today to receive updates on the latest news, cybersecurity tips and tricks and more. Enter your name and email address below to be the first to know.
Download Your FREE E-book Today

Not everything is black and white in business. Yet the importance of business efficiency is indisputable. To find out everything you need to know about the best choices for your business, download your copy of our free eBook - Efficient Businesses Run On Efficient I.T.
Thanks for this. I’m just getting into using sql with Kingdom and my first query was to pull tops. This helped tons.
Thanks!
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.