IT tutorials
 
Technology
 

SQL Server 2012 : Creating Tables and Other Objects - Navigating the Object Explorer Tree

12/14/2013 2:29:50 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

One of the most useful features within a typical SSMS dialog box is the ability to script the actions of a dialog box instead of actually executing the action against the server. For example, launch the New Database dialog box from the Databases node in Object Explorer. This will launch the dialog box shown in Figure 1. As an example, enter SmartCommunityBank in the “Database name” text box.

images

Figure 1. New Database dialog box in SQL Server Management Studio

If you click the OK button, the database will be created, and the dialog box will close. However, if you want to know exactly what T-SQL statements will be executed as a result of what you input in this dialog box, click the downward-facing arrow on the Script button at the top of the dialog box. This will pop up a list of destinations for the script, as shown in Figure 2.

images

Figure 2. Script options

If you select Script Action to New Query Window, this will open a new Query Editor window and populate it with the CREATE DATABASE script shown here:

CREATE DATABASE [SmartCommunityBank]
 CONTAINMENT = NONE
 ON  PRIMARY
( NAME = N'SmartCommunityBank', FILENAME = N'C:\Program Files\Microsoft SQL Server\images
MSSQL11.MSSQLSERVER\MSSQL\DATA\SmartCommunityBank.mdf' , SIZE = 4096KB , FILEGROWTH images
= 1024KB )
 LOG ON
( NAME = N'SmartCommunityBank_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\images
MSSQL11.MSSQLSERVER\MSSQL\DATA\SmartCommunityBank_log.ldf' , SIZE = 1024KB , FILEGROWTH images
= 10%)
GO
ALTER DATABASE [SmartCommunityBank] SET COMPATIBILITY_LEVEL = 110
GO
ALTER DATABASE [SmartCommunityBank] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [SmartCommunityBank] SET ANSI_NULLS OFF
GO
ALTER DATABASE [SmartCommunityBank] SET ANSI_PADDING OFF
GO
ALTER DATABASE [SmartCommunityBank] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [SmartCommunityBank] SET ARITHABORT OFF
GO
ALTER DATABASE [SmartCommunityBank] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [SmartCommunityBank] SET AUTO_CREATE_STATISTICS ON
GO
ALTER DATABASE [SmartCommunityBank] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [SmartCommunityBank] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [SmartCommunityBank] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [SmartCommunityBank] SET CURSOR_DEFAULT  GLOBAL
GO
ALTER DATABASE [SmartCommunityBank] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [SmartCommunityBank] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [SmartCommunityBank] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [SmartCommunityBank] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [SmartCommunityBank] SET  DISABLE_BROKER
GO
ALTER DATABASE [SmartCommunityBank] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [SmartCommunityBank] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [SmartCommunityBank] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [SmartCommunityBank] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [SmartCommunityBank] SET  READ_WRITE
GO
ALTER DATABASE [SmartCommunityBank] SET RECOVERY FULL
GO
ALTER DATABASE [SmartCommunityBank] SET  MULTI_USER
GO
ALTER DATABASE [SmartCommunityBank] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [SmartCommunityBank] SET TARGET_RECOVERY_TIME = 0 SECONDS
GO
USE [SmartCommunityBank]
GO
IF NOT EXISTS (SELECT name FROM sys.filegroups WHERE is_default=1 AND name = N'PRIMARY')images
 ALTER DATABASE [SmartCommunityBank] MODIFY FILEGROUP [PRIMARY] DEFAULT
GO

Note Choosing to script the action of a dialog box is a great way to learn which T-SQL statements perform which actions.

In this case, you can see that the CREATE DATABASE statement is used to create a database.

To create the database, click the Execute button the toolbar.

 
Others
 
- SQL Server 2012 : Creating Tables and Other Objects - Navigating the Object Explorer Tree
- Using the Windows PowerShell in an Exchange Server 2007 Environment : Using EMS to Do Administrative Server Tasks
- Using the Windows PowerShell in an Exchange Server 2007 Environment : Using EMS to Do Administrative Mailbox Tasks
- Using the Windows PowerShell in an Exchange Server 2007 Environment : Managing Cmdlets
- Using the Windows PowerShell in an Exchange Server 2007 Environment : Creating Your Own Cmdlet
- PowerShell for Microsoft SharePoint 2010 : Special Operators
- PowerShell for Microsoft SharePoint 2010 : Type Operators
- PowerShell for Microsoft SharePoint 2010 : Redirection Operators
- PowerShell for Microsoft SharePoint 2010 : Logical Operators
- PowerShell for Microsoft SharePoint 2010 : Comparison Operators
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us