1 / 38

SQL DDL

SQL DDL. Data Definition Language in SQL. Data types. BLOB: binary large object. CREATE database script file. -- This will create the database 's1234567'for a user with ID = 'SDSMT1234567' CREATE DATABASE s1234567 ON PRIMARY (NAME = s1234567,

viviana
Download Presentation

SQL DDL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SQL DDL • Data Definition Language in SQL

  2. Data types BLOB: binary large object

  3. CREATE database script file • -- This will create the database 's1234567'for a user with ID = 'SDSMT\1234567' • CREATE DATABASE s1234567 • ON PRIMARY • (NAME = s1234567, • FILENAME = 'C:\program files\microsoft sql server\mssql\data\s1234567.mdf', • SIZE = 2, MAXSIZE = 10, FILEGROWTH = 2) • GO • -- This will create the SQL Logins for a student • EXEC sp_grantlogin 'SDSMT\1234567' • GO • -- This will grant the Login access to the database 's1234567' and make the student a member • -- of the 'public' database role • USE s1234567 • GO • EXEC sp_grantdbaccess 'SDSMT\1234567' • GO • -- This will make the student a member of the 'db_owner' role on the DB, so he/she can do • -- whatever he/she need to in the database • USE s1234567 • GO • EXEC sp_addrolemember 'db_owner', 'SDSMT\1234567' • GO • -- This will change the default database for the student, so when he/she open Query • -- Analyzer, he/she will be attached to the database s1234567 • EXEC sp_defaultdb 'SDSMT\1234567', 's1234567' • GO

More Related