Like all CMS solutions, Episerver stores your website's data within a database and provides a brilliant collection of API's to allow developers to access that data. When we build a website, developers should never directly call the CMS database for numerous reason, scaling, upgrade-ability, performance, security to name a few. When building a website or trying to debug a live server, it can sometimes to be useful to directly query the database to find out key bits of information about the state of the platform. In today's guide, I'm going to cover some useful SQL scripts I've used throughout the years.
One script I frequently use is a script that lists out all the tables in a database and all their properties:
select sysobjects.Name, syscolumns.Name
from sysobjects inner join syscolumns on sysobjects.id = syscolumns.id
where sysobjects.xtype = 'U'
order by sysobjects.Name, syscolumns.colorder
I only need to look in the database once in a blue moon and that's usually when something's gone wrong. I can work months at a time without needing to look into SQL so memorising the Episerver database structure seems a waste of brain cells. Instead, I usually run the above script on the CMS, or commerce database to help me quickly narrow down the tables I need to look into.
Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge