I want to create a database with Size limitation. I am using sql server 2008r2 edition. Maximum size should be only 20GB. That means it should allow only 20GB space for particular database. How can I do this?
You can set Maxsize on both the data and the log files of your database. If the Max size of your database is 20GB you have to make sure the combined max size of both is 20 GB.
Remember to allocate enough room for the log file, so you don't run into issues early on.
You can do this by going into SSMS, right click your database, properties and go to Files. If you want to script it, it can also be done. Take a look at the BOL to find the syntax : ALTER DATABASE FILE
Perhaps this is also useful for you: Transaction Log Administration Best Practices