By using the SQL Server Management Studio that installs with SQL Server you can perform a number of database administration tasks such as creating databases and inserting test data. In this lesson I will show you how to perform three administrative tasks to create and start using a new database.
First, let’s create a new database. Logon to the Management Studio and right click on Databases, then choose “New Database”. You can enter the name for the new database there and Management Studio will fill in the rest of the information for you. Click here to watch a video example of how to create a new database. In the example I created a new database called “csharpuniversity”.
After you have a database created, it should show up in the list of available databases when you expand the Databases node in Management Studio. If you expand the new database that you created, you should see a list of available things to administer such as Database Diagrams, Tables, Views, Synonyms, Security, etc. Right click on Tables and choose “New Table”. Once the table creation window comes up, you will be able to define all the columns for your new table. You have the ability to specify what data types and size to use for each column, as well as specify the primary key for the table. Click here to watch a video example of how to create a new table. In the example I created a new table called “customer”.
Once your new table is created, you may want to populate it with some test data. Management Studio has a feature to help you easily do that. Expand the list of Tables in your database and right click on the table name, then choose “Edit Top 200 Rows”. Once the data editor window comes up, you can create and edit records in the database table. Click here to watch a video example of how to insert test data. In the example I created three new test data records.
Once you have a SQL Server database to connect to and a table to query from, you should be able to start programming with ADO.NET to interface with your database. You can bring up the SQL Server Management Studio anytime that you need to create more tables or test data in your database.