I've almost used SQL server_SDE geodatabases for 3 years in GIS projects and I don't know how can I create a stored procedure in geodatabase.I use ESRI case tool to create a geodatabase in ArcCatalog(using xml file as described in ESRI documentations),so I never created a geodatabase with DDL scripts,But i would like to know (and do) creating a geodatabase using DDL commands in SQL Server(while using SDE and versioning) and adding stored procedure to this geodatabase.As I know,sde creates some metadata tables and breaks data of versioned tables into some other tables(like a_xx and f_xx,for example a89,f89) so that some records of table is saved in these helping tables,so that I don't know how can I find the name of these helping tables and basically do i have to work with them in stored procedure or not.
Is there any document or guide line to show how can create a geodatabase using DDL command in an environment like SQL server management studio?and how can create stored procedures in geodatabase and how can call it?