SQL Server - Database

2 - Management

2.1 - Create

  • GUI


CREATE DATABASE TestDB
GO

2.2 - List


SELECT Name from sys.Databases
GO


Name                                                                                                                           
----------
master                                                                                                                         
tempdb                                                                                                                         
model                                                                                                                          
msdb

2.3 - Use


USE TestDB
GO

2.3.1 - Drop


EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'yourdbname'
GO

USE [master]
GO
ALTER DATABASE [yourdbname] SET  SINGLE_USER WITH ROLLBACK IMMEDIATE
GO

DROP DATABASE [yourdbname]
GO


Data Science
Data Analysis
Statistics
Data Science
Linear Algebra Mathematics
Trigonometry

Powered by ComboStrap