Users Online

· Guests Online: 11

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

01 CREATE DATABASE simple version

01 CREATE DATABASE simple version
Microsoft Technologies Courses » SQL Server Database Creation, Configuration and Alteration
Categories Most Recent Top Rated Popular Courses
USE [master]; GO -- What version of SQL Server am I running on? SELECT SERVERPROPERTY (N'ProductVersion') AS [ProductVersion] , SERVERPROPERTY (N'ProductLevel') AS [ProductLevel]; GO -- What databases are already on this SQL Server instance? SELECT [name] , [database_id] , [create_date] FROM sys.[databases]; GO -- In the simplest form, we can create a database as follows: CREATE DATABASE [PluralsightDemo]; GO -- Rules regarding the name: -- Maximum 128 characters (123 if the logical name isn't -- specified for the log file) -- Can't already be used by another database on the same -- SQL Server instance -- Viewing databases on the SQL Server instance, full view of -- things SELECT [name] , [database_id] , [source_database_id] , [owner_sid] , [create_date] , [compatibility_level] , [collation_name] , [user_access] , [user_access_desc] , [is_read_only] , [is_auto_close_on] , [is_auto_shrink_on] , [state] , [state_desc] , [is_in_standby] , [is_cleanly_shutdown] , [is_supplemental_logging_enabled] , [snapshot_isolation_state] , [snapshot_isolation_state_desc] , [is_read_committed_snapshot_on] , [recovery_model] , [recovery_model_desc] , [page_verify_option] , [page_verify_option_desc] , [is_auto_create_stats_on] , [is_auto_update_stats_on] , [is_auto_update_stats_async_on] , [is_ansi_null_default_on] , [is_ansi_nulls_on] , [is_ansi_padding_on] , [is_ansi_warnings_on] , [is_arithabort_on] , [is_concat_null_yields_null_on] , [is_numeric_roundabort_on] , [is_quoted_identifier_on] , [is_recursive_triggers_on] , [is_cursor_close_on_commit_on] , [is_local_cursor_default] , [is_fulltext_enabled] , [is_trustworthy_on] , [is_db_chaining_on] , [is_parameterization_forced] , [is_master_key_encrypted_by_server] , [is_published] , [is_subscribed] , [is_merge_published] , [is_distributor] , [is_sync_with_backup] , [service_broker_guid] , [is_broker_enabled] , [log_reuse_wait] , [log_reuse_wait_desc] , [is_date_correlation_on] , [is_cdc_enabled] , [is_encrypted] , [is_honor_broker_priority_on] , [replica_id] , [group_database_id] , [default_language_lcid] , [default_language_name] , [default_fulltext_language_lcid] , [default_fulltext_language_name] , [is_nested_triggers_on] , [is_transform_noise_words_on] , [two_digit_year_cutoff] , [containment] , [containment_desc] , [target_recovery_time_in_seconds] FROM sys.[databases]; GO -- Given no explicit configurations, what are the details -- of our new database? EXEC sys.[sp_helpdb] N'PluralsightDemo'; GO -- Where is the default path designated? SELECT SERVERPROPERTY (N'instancedefaultdatapath') AS [DefaultFile] , SERVERPROPERTY (N'instancedefaultlogpath') AS [DefaultLog]; -- The default path is designated in the registry and you -- can change via SSMS or via xp_instance_regwrite USE [master]; EXEC [xp_instance_regwrite] N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultData', REG_SZ, N'S:\SQLskills\MDF'; EXEC [xp_instance_regwrite] N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'DefaultLog', REG_SZ, N'S:\SQLskills\LOG'; GO -- Given no explicit configurations, what are the details -- of our new database? EXEC sys.[sp_helpdb] N'PluralsightDemo'; GO -- Default sizes use the model database EXEC sys.[sp_helpdb] N'model'; GO -- Cleanup before the next demo USE [master]; GO DROP DATABASE [PluralsightDemo]; GO
Uploader Date Added Views Rating
Superadmin 04.04.20 15 No Rating
Description
01 CREATE DATABASE simple version

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.
Render time: 0.96 seconds
10,882,996 unique visits