Surendra Sharma

Surendra Sharma

Search This Blog

Saturday, February 27, 2016

How to do database documentation freely



I am working on project where client asked for the documentation.

Developers hate documentation, especially when they have to create it :)

It’s fine if the documentation is about project, but what if client asked about database documentation?

My mind started to think, is there any way to create this documentation automatically or with least efforts?

I found three ways which are great to create database documentation.

1.    Database Diagrams

It provides database schema with relationships and tables-columns details in SQL Server itself as shown below


2.    DB>doc
It’s a free command line tool which can be download from https://sqldbdoc.codeplex.com/ .

It provides option to generate output report in HTML, wikiplex or XML format.

Its syntax is sqldbdoc connection fileName [/y] [/f:value] [/debug]

Parameter details are
·         connection -  connection string of database
·         filename - output file name
·         [/y] - overwrite output file
·         [/f:value] - output format: html, wikiplex, xml (autodetected when omitted)
·         [/debug] - debug mode (show detailed error messages)

How to use this tool?
1.    Download sqldbdoc.exe from https://sqldbdoc.codeplex.com/ and keep it in some folder, for example, D:\Share

2.    Type cmd in RUN window which open command prompt 

3.    Change directory to D:\Share and type below command with SQL server connection string and output file name
D:\Share>sqldbdoc.exe "Data Source=.\SqlExpress;user id=sa;password=test@123;DATABASE= Sitecore_WebForms" Report.htm
4.       You should get below output which indicate successful report generation
Altairis DB>doc version 1.0.0.0
Copyright (c) Altairis, 2011 | www.altairis.cz | SqlDbDoc.codeplex.com
Autodetecting output format...
Output format: html
5.    Open “Report.htm” from current directory i.e. D:\Share. You should get below nicely formatted report as

 
  
1.    SQL Server Compact & SQLite Toolbox

You can download and install this free Visual Studio addon SqlCeToolbox.4.5.0.1.vsix from https://visualstudiogallery.msdn.microsoft.com/0e313dfd-be80-4afb-b5e9-6e74d369f7a1/

How to use it?

·         Open Visual Studio and click on Tools -> SQL Server Compact/SQLite Toolbox menu item as


·         Connect to any SQL server database which need to be documented.
Once connected, you can create database graph of the tables by selecting option “Create SQL Server Database Graph (DGML)” as

 

·         This tool generate DGML file which show all selected tables with their columns and relationships. You can save this screen as image by clicking on Copy Image option as shown in the same screen.

 

·         You can also save the SQL connection database as SQL Server Compact file format which save this database in .sdf file format.
In this format you can do the database documentation in HTML format by selecting below option


You should get below HTML report


This HTML report is same as DB>Doc tool report. Internally this Visual studio add on uses DB>Doc utility.

My suggestion is that combine SQL Designer schema image with this HTML report to create better database documentation.

Also I found that command line utility DB>Doc is more easy to use for developers.

I hope these steps help you to do the boring documentation automatically and save your time.

Please leave your comments or share these technics if it’s useful for you.
 

Thursday, November 26, 2015

Why multilist field is not showing all the items in Sitecore



I have just started working on new Sitecore project. From couple of weeks I was busy on requirement gathering and doing a manager kind of works (Boring). Programming, coding and technical stuffs are my first love.

Within this new project, one of my teammate created one folder in Sitecore and populated 400 items within it. He pointed that folder to multilist control.

He started complaining that he is not getting all the 400 items of folder in Multilist. I thought he was doing something wrong.

Later on I didn't found any reason why multilist is showing only first 100 records and why not showing all 400 items?

Solution:-
I come to know that there is one setting in web.config file where it’ss mentioned that multilist and valuelookup control will only show first 100 items. If you want to show all the items then keep its value to 0.

<!--  Query.MaxItems
      Specifies the max number of items in a query result set.
      If the number is 0, all items are returned. This may affect system performance, if a large query result is returned.
      This also controls the number of items in Lookup, Multilist and Valuelookup fields.
      Default value: 100
-->
<setting name="Query.MaxItems" value="100" />

But Sitecore also warns that if you set its value to 0 than it may affect Sitecore performance for large results set.

I am big fan of Sitecore configuration technique.

Please leave your comments or share this trick if it’s useful for you.