472,981 Members | 1,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,981 software developers and data experts.

DataBase In Action Series Part I

Database:
It is an organized collection of structured information or data, typically stored electronically in a computer system. It is usually controlled by DBMS. In general data and DBMS along with the application which is associated with them is referred to as a database system.
DBMS- database management system is an interface between the database and the end-user.
SSMS(SQL Server Management Studio) it is only a client tool that connects the database. It is not server a just software that connects to a database server by using server IP, name and credentials.
What is data?
Data is a collection of a small info unit that is distinct. It can be used in a variety of forms such as text, numbers, media, bytes, etc. It can be stored in pieces of paper or electronic memory, etc. Word ' Data' originates from the word ' datum' which means' single piece of information.

Evolution of Databases
  1. File-Based
  2. Hierarchical Data Model
  3. Network database
  4. No-SQL database
  5. Cloud databases
  6. Self-driving databases

SQL Server database can be created, drop and altered. For doing this you can use SSMS or simple query.
1)Create a Database Using Query:
Expand|Select|Wrap|Line Numbers
  1. Create database database-name
When you create database 2 files were generated which is below
.MDF file- It is a data file that contains actual data.
.LDF file:- It is a log file that means it is a transaction log file which also used to recover the database.

2)Rename Database:
Expand|Select|Wrap|Line Numbers
  1. alter database original_database_name modify name=new_database_name;
The above query changes the orignal_database_name to new_database_name.

Another way to change the database name by using the system stored procedure.
Expand|Select|Wrap|Line Numbers
  1. execute sp_renamedb 'temp1','temp'
  2.  
The procedure takes 2 input parameter original name and name to change means a new name.


3)Drop or Delete Database:
when you drop the database behind the scene it will delete .MDF and.LDF file which is associated with this database.

Expand|Select|Wrap|Line Numbers
  1. Drop database database_name
This will delete database_name database. But one thing to remember when you want to drop the database you will not use this currently or you need to switch another database and then you need to drop a database. Also, make sure that no one can access this database. If any use connected then you need to put a database in single-user mode and then drop this.
The query for this to put a database in single-user mode is

Expand|Select|Wrap|Line Numbers
  1. Alter database database_name set SINGLE_USER with rollback immediate
In above query rollback immediate is used for suppose we have 2 users A and B, A is running some query on our database and B want to drop that database so when b fires above query it will forcefully stop user A query execution and revert back it changes immediately if the transaction is incomplete and close that connection.
Nov 7 '19 #1
0 2792

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Uli | last post by:
Dear group, I have to replicate remote data to a SQL Server in the headquarter. The data are on a site which does not have permanent online-connection to the headquarter. I have written a...
2
by: Byrocat | last post by:
I just got pointed at a number of DB2 databases and found that the DAS has not been enabled on the server they reside upon. I'm trying to get an understanding of whether the DAS is installed as...
3
by: Hans [DiaGraphIT] | last post by:
Hi! Can anyone help me with translating a VB-code to C#? I'm reading the walkthrough: Passing data to a custom action. In part 4 were you create an installer class there is a example of...
1
by: basha | last post by:
hi can u help me how to write code to handle errors in dabase in asp.net pls,very urgent bye basha
0
by: shen.chang.cs | last post by:
Hi, all, I use .Net V2.0 and WebControl TreeView. I want to have an OnClick() function to handle user click on certain end nodes but not on other nodes. Someone suggested to use a Java...
12
by: wuzertheloser | last post by:
I need help with Taylor Series Part A: Scan the angle in degrees x_deg. Express this angle in radians by using x=PI*x_deg/180, and calculate Y=cos^2(x) by using the math.h...
1
by: vijay | last post by:
HI All, I am using C#.net 2005 and my problem is, i want to automatically run sql script to Restore database as a part of .net Setup and Deployment. I have done setup for my...
0
by: ummaria | last post by:
Hello, I have posted a question related to this problem before but I never got the full understanding of the concept. I would really appreciate if someone could help me, my deadline for the design...
13
by: Matt F | last post by:
I have a deployment project that I'm setting up. I need to perform a different custom action based on whether this is a first time install or an update. Does anyone have any idea if it's possible...
0
MrMancunian
by: MrMancunian | last post by:
How to create a database connection without using wizards Introduction I've seen a lot of questions on the net about getting data from, and saving data to databases. Here's a little insight how...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.