Upload
dinhdang
View
232
Download
1
Embed Size (px)
Citation preview
My Company Tel: +44 1234 567 9898Fax: +44 1234 545 9999
email: info@@company.com
SQL Server Database Schema Document
Created using
SQLserverPrintMacro Variables Substitution Example
General Date 14/01/2017 16:05:45Long Date 14 January 2017Short Date 14/01/2017Long Time 16:05:45Short Time 16:05Today 14/01/2017 16:05:45Server Name STARPRINT-DEV-XDatabase Name pubs
Prepared byJoginder S Nahil
on 14/01/2017 16:05:45
WWW.STARPRINTTOOLS.COM
Table of Contents pubs Table of Contents
14/01/2017 16:05:43 2 of 46
STARPRINT-DEV-X\SQLSERVER2016 ......................................................................................................................................................................4Databases .................................................................................................................................................................................................................4
pubs [Normal] .......................................................................................................................................................................................................4Output 'pubs' Database Properties ...................................................................................................................................................................4Tables ................................................................................................................................................................................................................7
dbo.authors ...................................................................................................................................................................................................7dbo.discounts ................................................................................................................................................................................................9dbo.employee ..............................................................................................................................................................................................11dbo.jobs .......................................................................................................................................................................................................14dbo.pub_info ................................................................................................................................................................................................16dbo.publishers .............................................................................................................................................................................................18dbo.roysched ...............................................................................................................................................................................................20dbo.sales .....................................................................................................................................................................................................22dbo.stores ....................................................................................................................................................................................................24dbo.titleauthor ..............................................................................................................................................................................................26dbo.titles ......................................................................................................................................................................................................28
Views ...............................................................................................................................................................................................................30dbo.titleview .................................................................................................................................................................................................30
Programmability ..............................................................................................................................................................................................31Stored Procedures ......................................................................................................................................................................................31
dbo.byroyalty ...........................................................................................................................................................................................31dbo.reptq1 ...............................................................................................................................................................................................32dbo.reptq2 ...............................................................................................................................................................................................33dbo.reptq3 ...............................................................................................................................................................................................34
Assemblies ..................................................................................................................................................................................................34Microsoft.SqlServer.Types ......................................................................................................................................................................34
User-defined Types .....................................................................................................................................................................................34empid .......................................................................................................................................................................................................34id ..............................................................................................................................................................................................................35tid .............................................................................................................................................................................................................35
Security ...........................................................................................................................................................................................................36Users ...........................................................................................................................................................................................................36
dbo...........................................................................................................................................................................................................36guest ........................................................................................................................................................................................................36INFORMATION_SCHEMA ......................................................................................................................................................................37sys ...........................................................................................................................................................................................................37
Roles ...........................................................................................................................................................................................................37Database roles ........................................................................................................................................................................................37
db_accessadmin ..................................................................................................................................................................................37db_backupoperator ..............................................................................................................................................................................38db_datareader .....................................................................................................................................................................................38db_datawriter .......................................................................................................................................................................................38db_ddladmin ........................................................................................................................................................................................39db_denydatareader .............................................................................................................................................................................39db_denydatawriter ...............................................................................................................................................................................39db_owner .............................................................................................................................................................................................40db_securityadmin ................................................................................................................................................................................40public ...................................................................................................................................................................................................41
Schemas .....................................................................................................................................................................................................41db_accessadmin......................................................................................................................................................................................41db_backupoperator ..................................................................................................................................................................................41db_datareader .........................................................................................................................................................................................41db_datawriter ...........................................................................................................................................................................................42db_ddladmin ............................................................................................................................................................................................42db_denydatareader .................................................................................................................................................................................42db_denydatawriter ...................................................................................................................................................................................42db_owner .................................................................................................................................................................................................42db_securityadmin ....................................................................................................................................................................................43dbo...........................................................................................................................................................................................................43guest ........................................................................................................................................................................................................44INFORMATION_SCHEMA ......................................................................................................................................................................44
Table of Contents pubs Table of Contents
14/01/2017 16:05:43 3 of 46
sys ...........................................................................................................................................................................................................44
STARPRINT-DEV-X\Dell pubs
pubs 4 of 46 14 January 2017 16:05:42
[pubs]Database in Database 'pubs'
GeneralProperty ValueActive Connections 1Auto Create Statistics Enabled TrueAuto Update Statistics Enabled TrueCase Sensitive FalseCollation Latin1_General_CI_ASCompatibility Level Version130Create Date 10/10/2016 12:28:42Database Guid aa46f67c-8315-4118-95cc-3727a71cb9dcDatabase Snapshot Base NameData Space Usage 1288Dbo Login TrueDefault File Group PRIMARYDefault Full Text CatalogDefault Schema dboI D 6Index Space Usage 1312Is Accessible TrueIs Database Snapshot FalseIs Database Snapshot Base FalseIs Db Access Admin TrueIs Db Backup Operator TrueIs Db Datareader TrueIs Db Datawriter TrueIs Db Ddl Admin TrueIs Db Deny Datareader FalseIs Db Deny Datawriter FalseIs Db Owner TrueIs Db Security Admin TrueIs Full Text Enabled TrueIs Mail Host FalseIs Mirroring Enabled FalseIs System Object FalseIs Updateable TrueLast Backup Date 01/01/0001 00:00:00Last Log Backup Date 01/01/0001 00:00:00Log Reuse Wait Status NothingMirroring Failover Log Sequence Number 0Mirroring I D 00000000-0000-0000-0000-000000000000Mirroring PartnerMirroring Role NoneMirroring Role Sequence 0Mirroring Safety Level NoneMirroring Safety Sequence 0Mirroring Status NoneMirroring WitnessMirroring Witness Status NoneOwner STARPRINT-DEV-X\DellPrimary File Path C:\Program Files\Microsoft SQL Server\MSSQL13.SQLSERVER2016\MSSQL
\DATARecovery Fork Guid 01993a49-c172-46f0-aeea-b2dd88aa8a5c
STARPRINT-DEV-X\Dell pubs
pubs 5 of 46 14 January 2017 16:05:42
Replication Options NoneService Broker Guid 8a12231a-027e-4345-a93a-2bf12605a282Size 16Space Available 3840Status NormalUser Name dboVersion 852
Property Value
MiscellaneousProperty ValueActive Connections 1Broker Enabled TrueCase Sensitive FalseDatabase Guid aa46f67c-8315-4118-95cc-3727a71cb9dcDatabase Snapshot Base NameData Space Usage 1288Dbo Login TrueDefault File Group PRIMARYDefault Full Text CatalogDefault Schema dboIndex Space Usage 1312Is Accessible TrueIs Database Snapshot FalseIs Database Snapshot Base FalseIs Db Access Admin TrueIs Db Backup Operator TrueIs Db Datareader TrueIs Db Datawriter TrueIs Db Ddl Admin TrueIs Db Deny Datareader FalseIs Db Deny Datawriter FalseIs Db Owner TrueIs Db Security Admin TrueIs Full Text Enabled TrueIs Mail Host FalseIs Mirroring Enabled FalseIs Parameterization Forced FalseIs System Object FalseIs Updateable TrueLocal Cursors Default FalseLog Reuse Wait Status NothingPrimary File Path C:\Program Files\Microsoft SQL Server\MSSQL13.SQLSERVER2016\MSSQL
\DATARecovery Fork Guid 01993a49-c172-46f0-aeea-b2dd88aa8a5cReplication Options NoneService Broker Guid 8a12231a-027e-4345-a93a-2bf12605a282Snapshot Isolation State DisabledUser Access MultipleUser Name dboVersion 852
FilesName File Type Filegroup Initial Size Autogrowthpubs Data PRIMARY 8192 65536,KBpubs_log Log 8192 65536,KB
STARPRINT-DEV-X\Dell pubs
pubs 6 of 46 14 January 2017 16:05:42
File GroupsName Files Read Only DefaultPRIMARY 1 False True
OptionsProperty ValueAnsi Null Default FalseAnsi Nulls Enabled FalseAnsi Padding Enabled FalseAnsi Warnings Enabled FalseArithmetic Abort Enabled FalseAuto Close FalseAuto Create Statistics Enabled TrueAuto Shrink FalseAuto Update Statistics Async FalseAuto Update Statistics Enabled TrueClose Cursors On Commit Enabled FalseCompatibility Level Version130Concatenate Null Yields Null FalseDatabase Ownership Chaining FalseDate Correlation Optimization FalseNumeric Round Abort Enabled FalsePage Verify ChecksumQuoted Identifiers Enabled FalseRead Only FalseRecovery Model FullRecursive Triggers Enabled FalseTrustworthy False
Explicit Permissions:Permission Grantor Grant With Grant DenyConnect dbo X
MirroringProperty ValueMirroring Failover Log Sequence Number 0Mirroring I D 00000000-0000-0000-0000-000000000000Mirroring PartnerMirroring Redo Queue Max Size 0Mirroring Role NoneMirroring Role Sequence 0Mirroring Safety Level NoneMirroring Safety Sequence 0Mirroring Status NoneMirroring Timeout 0Mirroring WitnessMirroring Witness Status None
STARPRINT-DEV-X\Dell pubs
pubs 7 of 46 14 January 2017 16:05:42
[dbo].[authors]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 au_id id X2 au_lname varchar(40)3 au_fname varchar(20)4 phone char(12) ('UNKNOWN')5 address varchar(40) X6 city varchar(20) X7 state char(2) X8 zip char(5) X9 contract bit
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 24 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 23Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary Keys
Name Columns Clu
ster
ed
Uni
que
UPKCL_auidind au_id X
Foreign KeysNone
TriggersNone
Indices
STARPRINT-DEV-X\Dell pubs
pubs 8 of 46 14 January 2017 16:05:42
Name Columns Clu
ster
ed
Uni
que
aunmind au_lnameau_fname
UPKCL_auidind au_id X
ChecksCK__authors__au_id__239E4DCF
Created Modified State Enab
led
Che
cked
Text10/10/2016 12:28:43 10/10/2016 12:28:43 Existing X X ([au_id] like '[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]')
CK__authors__zip__25869641
Created Modified State Enab
led
Che
cked
Text10/10/2016 12:28:43 10/10/2016 12:28:43 Existing X X ([zip] like '[0-9][0-9][0-9][0-9][0-9]')
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 9 of 46 14 January 2017 16:05:42
[dbo].[discounts]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 discounttype varchar(40)2 stor_id char(4) X X3 lowqty smallint X4 highqty smallint X5 discount decimal(4,2)
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 8 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 3Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary KeysNone
Foreign Keys
Name Columns Che
ck
Enab
led
FK__discounts__stor___3B75D760FK__discounts__stor___3B75D760 X X Primary/Unique Key Base Table discounts stor_id Foreign Key Base Table stores stor_id
TriggersNone
IndicesNone
ChecksNone
STARPRINT-DEV-X\Dell pubs
pubs 10 of 46 14 January 2017 16:05:42
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 11 of 46 14 January 2017 16:05:42
[dbo].[employee]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 emp_id empid X2 fname varchar(20)3 minit char(1) X4 lname varchar(30)5 job_id smallint X ((1))6 job_lvl tinyint X ((10))7 pub_id char(4) X ('9952')8 hire_date datetime (getdate())
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 24 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 43Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary Keys
Name Columns Clu
ster
ed
Uni
que
PK_emp_id emp_id
Foreign Keys
Name Columns Che
ck
Enab
led
FK__employee__job_id__47DBAE45FK__employee__job_id__47DBAE45 X X Primary/Unique Key Base Table employee job_id Foreign Key Base Table jobs job_idFK__employee__pub_id__4AB81AF0FK__employee__pub_id__4AB81AF0 X X
STARPRINT-DEV-X\Dell pubs
pubs 12 of 46 14 January 2017 16:05:42
Primary/Unique Key Base Table employee pub_id Foreign Key Base Table publishers pub_id
Name Columns Che
ck
Enab
led
Triggers
Trigger Name Description State Enab
led
Del
ete^
Inse
rt
Upd
ate
employee_insupd Existing X X X
Property ValueAnsiNullsStatus TrueBodyStartIndex 71CreateDate 10/10/2016 12:28:43DeleteOrder NoneID 1285579618ImplementationType TransactSqlInsertOrder NoneInsteadOf FalseIsEncrypted FalseIsSystemObject FalseNotForReplication FalseQuotedIdentifierStatus TrueUpdateOrder NoneAssemblyNameClassNameDateLastModified 10/10/2016 12:28:43ExecutionContext CallerExecutionContextPrincipalMethodNamePolicyHealthState UnknownIsNativelyCompiled FalseIsSchemaBound False
Script12 CREATE TRIGGER employee_insupd3 ON employee4 FOR insert, UPDATE5 AS67 --Get the range of level for this job type from the jobs table.8 declare @min_lvl tinyint,9 @max_lvl tinyint,
10 @emp_lvl tinyint,11 @job_id smallint12 select @min_lvl = min_lvl,13 @max_lvl = max_lvl,14 @emp_lvl = i.job_lvl,15 @job_id = i.job_id16 from employee e, jobs j, inserted i17 where e.emp_id = i.emp_id AND i.job_id = j.job_id18 IF (@job_id = 1) and (@emp_lvl <> 10)19 begin
STARPRINT-DEV-X\Dell pubs
pubs 13 of 46 14 January 2017 16:05:42
20 raiserror (''Job id 1 expects the default level of 10.,16,1)21 ROLLBACK TRANSACTION22 end23 ELSE24 IF NOT (@emp_lvl BETWEEN @min_lvl AND @max_lvl)25 begin26 raiserror (''The level for job_id:%d should be between %d and %d.,27 16, 1, @job_id, @min_lvl, @max_lvl)28 ROLLBACK TRANSACTION29 end30
Indices
Name Columns Clu
ster
ed
Uni
que
employee_ind lnamefnameminit
X
PK_emp_id emp_id
ChecksCK_emp_id
Created Modified State Enab
led
Che
cked
Text10/10/2016 12:28:43 10/10/2016 12:28:43 Existing X X ([emp_id] like '[A-Z][A-Z][A-Z][1-9][0-9][0-9][0-9][0-9][FM]' OR
[emp_id] like '[A-Z]-[A-Z][1-9][0-9][0-9][0-9][0-9][FM]')
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 14 of 46 14 January 2017 16:05:42
[dbo].[jobs]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 job_id smallint X X2 job_desc varchar(50) ('New Position
- title notformalized yet')
3 min_lvl tinyint4 max_lvl tinyint
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 8 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 14Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary Keys
Name Columns Clu
ster
ed
Uni
que
PK__jobs__6E32B6A571385938 job_id X
Foreign KeysNone
TriggersNone
Indices
Name Columns Clu
ster
ed
Uni
que
PK__jobs__6E32B6A571385938 job_id X
ChecksCK__jobs__max_lvl__403A8C7D
STARPRINT-DEV-X\Dell pubs
pubs 15 of 46 14 January 2017 16:05:42
Created Modified State Enab
led
Che
cked
Text10/10/2016 12:28:43 10/10/2016 12:28:43 Existing X X ([max_lvl]<=(250))
CK__jobs__min_lvl__3F466844
Created Modified State Enab
led
Che
cked
Text10/10/2016 12:28:43 10/10/2016 12:28:43 Existing X X ([min_lvl]>=(10))
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 16 of 46 14 January 2017 16:05:42
[dbo].[pub_info]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 pub_id char(4) X X2 logo image X3 pr_info text X
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 120 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 8 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 8Text File Group PRIMARY
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary Keys
Name Columns Clu
ster
ed
Uni
que
UPKCL_pubinfo pub_id X
Foreign Keys
Name Columns Che
ck
Enab
led
FK__pub_info__pub_id__4316F928FK__pub_info__pub_id__4316F928 X X Primary/Unique Key Base Table pub_info pub_id Foreign Key Base Table publishers pub_id
TriggersNone
Indices
STARPRINT-DEV-X\Dell pubs
pubs 17 of 46 14 January 2017 16:05:42
Name Columns Clu
ster
ed
Uni
que
UPKCL_pubinfo pub_id X
ChecksNone
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 18 of 46 14 January 2017 16:05:42
[dbo].[publishers]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 pub_id char(4) X2 pub_name varchar(40) X3 city varchar(20) X4 state char(2) X5 country varchar(30) X ('USA')
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 8 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 8Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary Keys
Name Columns Clu
ster
ed
Uni
que
UPKCL_pubind pub_id X
Foreign KeysNone
TriggersNone
Indices
Name Columns Clu
ster
ed
Uni
que
UPKCL_pubind pub_id X
ChecksCK__publisher__pub_i__286302EC
STARPRINT-DEV-X\Dell pubs
pubs 19 of 46 14 January 2017 16:05:42
Created Modified State Enab
led
Che
cked
Text10/10/2016 12:28:43 10/10/2016 12:28:43 Existing X X ([pub_id]='1756' OR [pub_id]='1622' OR [pub_id]='0877' OR [pub_id]
='0736' OR [pub_id]='1389' OR [pub_id] like '99[0-9][0-9]')
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 20 of 46 14 January 2017 16:05:42
[dbo].[roysched]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 title_id tid X2 lorange int X3 hirange int X4 royalty int X
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 24 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 86Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary KeysNone
Foreign Keys
Name Columns Che
ck
Enab
led
FK__roysched__title___398D8EEEFK__roysched__title___398D8EEE X X Primary/Unique Key Base Table roysched title_id Foreign Key Base Table titles title_id
TriggersNone
Indices
Name Columns Clu
ster
ed
Uni
que
titleidind title_id
STARPRINT-DEV-X\Dell pubs
pubs 21 of 46 14 January 2017 16:05:42
ChecksNone
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 22 of 46 14 January 2017 16:05:42
[dbo].[sales]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 stor_id char(4) X X2 ord_num varchar(20) X3 ord_date datetime4 qty smallint5 payterms varchar(12)6 title_id tid X X
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 24 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 21Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary Keys
Name Columns Clu
ster
ed
Uni
que
UPKCL_sales stor_idord_numtitle_id
X
Foreign Keys
Name Columns Che
ck
Enab
led
FK__sales__stor_id__36B12243FK__sales__stor_id__36B12243 X X Primary/Unique Key Base Table sales stor_id Foreign Key Base Table stores stor_idFK__sales__title_id__37A5467CFK__sales__title_id__37A5467C X X
STARPRINT-DEV-X\Dell pubs
pubs 23 of 46 14 January 2017 16:05:42
Primary/Unique Key Base Table sales title_id Foreign Key Base Table titles title_id
Name Columns Che
ck
Enab
led
TriggersNone
Indices
Name Columns Clu
ster
ed
Uni
que
titleidind title_idUPKCL_sales stor_id
ord_numtitle_id
X
ChecksNone
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 24 of 46 14 January 2017 16:05:42
[dbo].[stores]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 stor_id char(4) X2 stor_name varchar(40) X3 stor_address varchar(40) X4 city varchar(20) X5 state char(2) X6 zip char(5) X
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 8 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 6Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary Keys
Name Columns Clu
ster
ed
Uni
que
UPK_storeid stor_id X
Foreign KeysNone
TriggersNone
Indices
Name Columns Clu
ster
ed
Uni
que
UPK_storeid stor_id X
ChecksNone
STARPRINT-DEV-X\Dell pubs
pubs 25 of 46 14 January 2017 16:05:42
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 26 of 46 14 January 2017 16:05:42
[dbo].[titleauthor]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 au_id id X X2 title_id tid X X3 au_ord tinyint X4 royaltyper int X
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 40 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 25Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary Keys
Name Columns Clu
ster
ed
Uni
que
UPKCL_taind au_idtitle_id
X
Foreign Keys
Name Columns Che
ck
Enab
led
FK__titleauth__au_id__30F848EDFK__titleauth__au_id__30F848ED X X Primary/Unique Key Base Table titleauthor au_id Foreign Key Base Table authors au_idFK__titleauth__title__31EC6D26FK__titleauth__title__31EC6D26 X X Primary/Unique Key Base Table titleauthor title_id Foreign Key Base Table
STARPRINT-DEV-X\Dell pubs
pubs 27 of 46 14 January 2017 16:05:42
titles title_idName Columns C
heck
Enab
led
TriggersNone
Indices
Name Columns Clu
ster
ed
Uni
que
auidind au_idtitleidind title_idUPKCL_taind au_id
title_idX
ChecksNone
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 28 of 46 14 January 2017 16:05:42
[dbo].[titles]Table in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 title_id tid X2 title varchar(80)3 type char(12) ('UNDECIDED'
)4 pub_id char(4) X X5 price money X6 advance money X7 royalty int X8 ytd_sales int X9 notes varchar(200) X
10 pubdate datetime (getdate())
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Data Space Used 8 KBDate Last Modified 10/10/2016 12:28:43File Group PRIMARYIndex Space Used 24 KBIs Indexable TrueIs Partitioned FalseIs System Object FalsePartition SchemeReplicated FalseRow Count 18Text File Group
Column - Extended PropertiesNone of columns were found to have any Extended Properties
Primary Keys
Name Columns Clu
ster
ed
Uni
que
UPKCL_titleidind title_id X
Foreign Keys
Name Columns Che
ck
Enab
led
FK__titles__pub_id__2D27B809FK__titles__pub_id__2D27B809 X X Primary/Unique Key Base Table titles pub_id Foreign Key Base Table
STARPRINT-DEV-X\Dell pubs
pubs 29 of 46 14 January 2017 16:05:42
publishers pub_idName Columns C
heck
Enab
led
TriggersNone
Indices
Name Columns Clu
ster
ed
Uni
que
titleind titleUPKCL_titleidind title_id X
ChecksNone
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 30 of 46 14 January 2017 16:05:42
[dbo].[titleview]View in Database 'pubs'
Columns
ID Name DataType Com
pute
d
Full
Text
Inde
x
Fore
ign
Key
Iden
tity
Not
For
Rep
l
Nul
labl
e
Prim
ary
Key
Pers
iste
d
Default1 title varchar(80)2 au_ord tinyint X3 au_lname varchar(40)4 price money X5 ytd_sales int X6 pub_id char(4) X
Script12 CREATE VIEW titleview3 AS45 select title, au_ord, au_lname, price, ytd_sales, pub_id6 from authors, titles, titleauthor7 where authors.au_id = titleauthor.au_id8 AND titles.title_id = titleauthor.title_id9
TriggersNone
IndicesNone
Explicit Permissions:None
PropertiesProperty ValueAnsi Nulls Status TrueCreate Date 10/10/2016 12:28:43Date Last Modified 10/10/2016 12:28:43Is Encrypted FalseIs Indexable FalseIs Schema Bound FalseIs System Object FalseReturns View Metadata False
STARPRINT-DEV-X\Dell pubs
pubs 31 of 46 14 January 2017 16:05:42
[dbo].[byroyalty]StoredProcedure in Database 'pubs'
PropertiesProperty ValueAssembly NameClass NameCreate Date 10/10/2016 12:28:43Date Last Modified 10/10/2016 12:28:43Execution Context CallerFor Replication FalseImplementation Type TransactSqlMethod NameRecompile FalseStartup False
Script12 CREATE PROCEDURE byroyalty @percentage int3 AS4 select au_id from titleauthor5 where titleauthor.royaltyper = @percentage6
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 32 of 46 14 January 2017 16:05:42
[dbo].[reptq1]StoredProcedure in Database 'pubs'
PropertiesProperty ValueAssembly NameClass NameCreate Date 10/10/2016 12:28:43Date Last Modified 10/10/2016 12:28:43Execution Context CallerFor Replication FalseImplementation Type TransactSqlMethod NameRecompile FalseStartup False
Script12 CREATE PROCEDURE reptq1 AS3 select4 case when grouping(pub_id) = 1 then ''ALL else pub_id end as pub_id,5 avg(price) as avg_price6 from titles7 where price is NOT NULL8 group by pub_id with rollup9 order by pub_id
10
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 33 of 46 14 January 2017 16:05:42
[dbo].[reptq2]StoredProcedure in Database 'pubs'
PropertiesProperty ValueAssembly NameClass NameCreate Date 10/10/2016 12:28:43Date Last Modified 10/10/2016 12:28:43Execution Context CallerFor Replication FalseImplementation Type TransactSqlMethod NameRecompile FalseStartup False
Script12 CREATE PROCEDURE reptq2 AS3 select4 case when grouping(type) = 1 then ''ALL else type end as type,5 case when grouping(pub_id) = 1 then ''ALL else pub_id end as pub_id,6 avg(ytd_sales) as avg_ytd_sales7 from titles8 where pub_id is NOT NULL9 group by pub_id, type with rollup
10
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 34 of 46 14 January 2017 16:05:42
[dbo].[reptq3]StoredProcedure in Database 'pubs'
PropertiesProperty ValueAssembly NameClass NameCreate Date 10/10/2016 12:28:43Date Last Modified 10/10/2016 12:28:43Execution Context CallerFor Replication FalseImplementation Type TransactSqlMethod NameRecompile FalseStartup False
Script12 CREATE PROCEDURE reptq3 @lolimit money, @hilimit money,3 @type char(12)4 AS5 select6 case when grouping(pub_id) = 1 then ''ALL else pub_id end as pub_id,7 case when grouping(type) = 1 then ''ALL else type end as type,8 count(title_id) as cnt9 from titles
10 where price >@lolimit AND price <@hilimit AND type = @type OR type LIKE ''%cook%11 group by pub_id, type with rollup12
Explicit Permissions:None
[Microsoft.SqlServer.Types]SqlAssembly in Database 'pubs'
PropertiesProperty Value
[dbo].[empid]UserDefinedDataType in Database 'pubs'
PropertiesProperty ValueAllow Identity FalseCollation Latin1_General_CI_ASDefaultDefault SchemaI D 259Length 9Max Length 9Nullable FalseNumeric Precision 0Numeric Scale 0Rule
STARPRINT-DEV-X\Dell pubs
pubs 35 of 46 14 January 2017 16:05:42
Rule SchemaSystem Type charVariable Length False
Property Value
Bound ColumnsName Parentemp_id [dbo].[employee]
Explicit Permissions:public [DatabaseRole]
Permission Grantor Grant With Grant DenyREFERENCES dbo X
[dbo].[id]UserDefinedDataType in Database 'pubs'
PropertiesProperty ValueAllow Identity FalseCollation Latin1_General_CI_ASDefaultDefault SchemaI D 257Length 11Max Length 11Nullable FalseNumeric Precision 0Numeric Scale 0RuleRule SchemaSystem Type varcharVariable Length True
Bound ColumnsName Parentau_id [dbo].[authors]au_id [dbo].[titleauthor]
Explicit Permissions:public [DatabaseRole]
Permission Grantor Grant With Grant DenyREFERENCES dbo X
[dbo].[tid]UserDefinedDataType in Database 'pubs'
PropertiesProperty ValueAllow Identity FalseCollation Latin1_General_CI_ASDefaultDefault SchemaI D 258Length 6
STARPRINT-DEV-X\Dell pubs
pubs 36 of 46 14 January 2017 16:05:42
Max Length 6Nullable FalseNumeric Precision 0Numeric Scale 0RuleRule SchemaSystem Type varcharVariable Length True
Property Value
Bound ColumnsName Parenttitle_id [dbo].[titles]title_id [dbo].[titleauthor]title_id [dbo].[sales]title_id [dbo].[roysched]
Explicit Permissions:public [DatabaseRole]
Permission Grantor Grant With Grant DenyREFERENCES dbo X
[dbo]User in Database 'pubs'
Database role membershipdb_owner
Schemas owned by this Userdbo
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 10/10/2016 12:28:43Default Schema dboHas D B Access TrueIs System Object TrueLogin STARPRINT-DEV-X\DellLogin Type WindowsUserUser Type SqlLogin
[guest]User in Database 'pubs'
Database role membershipNone
Schemas owned by this Userguest
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 08/04/2003 09:10:42Default Schema guest
STARPRINT-DEV-X\Dell pubs
pubs 37 of 46 14 January 2017 16:05:42
Has D B Access FalseIs System Object TrueLoginLogin Type SqlLoginUser Type NoLogin
Property Value
[INFORMATION_SCHEMA]User in Database 'pubs'
Database role membershipNone
Schemas owned by this UserINFORMATION_SCHEMA
PropertiesProperty ValueCreate Date 13/04/2009 12:59:11Date Last Modified 13/04/2009 12:59:11Default SchemaHas D B Access FalseIs System Object TrueLoginLogin Type SqlLoginUser Type NoLogin
[sys]User in Database 'pubs'
Database role membershipNone
Schemas owned by this UserMicrosoft.SqlServer.Typessys
PropertiesProperty ValueCreate Date 13/04/2009 12:59:11Date Last Modified 13/04/2009 12:59:11Default SchemaHas D B Access FalseIs System Object TrueLoginLogin Type SqlLoginUser Type NoLogin
[db_accessadmin]DatabaseRole in Database 'pubs'
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14
STARPRINT-DEV-X\Dell pubs
pubs 38 of 46 14 January 2017 16:05:42
Is Fixed Role TrueOwner dbo
Property Value
Owned Schemasdb_accessadmin
MembersNone
Explicit Permissions:None
[db_backupoperator]DatabaseRole in Database 'pubs'
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14Is Fixed Role TrueOwner dbo
Owned Schemasdb_backupoperator
MembersNone
Explicit Permissions:None
[db_datareader]DatabaseRole in Database 'pubs'
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14Is Fixed Role TrueOwner dbo
Owned Schemasdb_datareader
MembersNone
Explicit Permissions:None
[db_datawriter]DatabaseRole in Database 'pubs'
Properties
STARPRINT-DEV-X\Dell pubs
pubs 39 of 46 14 January 2017 16:05:42
Property ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14Is Fixed Role TrueOwner dbo
Owned Schemasdb_datawriter
MembersNone
Explicit Permissions:None
[db_ddladmin]DatabaseRole in Database 'pubs'
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14Is Fixed Role TrueOwner dbo
Owned Schemasdb_ddladmin
MembersNone
Explicit Permissions:None
[db_denydatareader]DatabaseRole in Database 'pubs'
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14Is Fixed Role TrueOwner dbo
Owned Schemasdb_denydatareader
MembersNone
Explicit Permissions:None
[db_denydatawriter]DatabaseRole in Database 'pubs'
STARPRINT-DEV-X\Dell pubs
pubs 40 of 46 14 January 2017 16:05:42
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14Is Fixed Role TrueOwner dbo
Owned Schemasdb_denydatawriter
MembersNone
Explicit Permissions:None
[db_owner]DatabaseRole in Database 'pubs'
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14Is Fixed Role TrueOwner dbo
Owned Schemasdb_owner
Membersdbo
Explicit Permissions:None
[db_securityadmin]DatabaseRole in Database 'pubs'
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14Is Fixed Role TrueOwner dbo
Owned Schemasdb_securityadmin
MembersNone
Explicit Permissions:None
[public]
STARPRINT-DEV-X\Dell pubs
pubs 41 of 46 14 January 2017 16:05:42
DatabaseRole in Database 'pubs'
PropertiesProperty ValueCreate Date 08/04/2003 09:10:42Date Last Modified 13/04/2009 12:59:14Is Fixed Role FalseOwner dbo
Owned SchemasNone
MembersNone
Explicit Permissions:None
[db_accessadmin]Schema in Database 'pubs'
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner db_accessadmin
[db_backupoperator]Schema in Database 'pubs'
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner db_backupoperator
[db_datareader]Schema in Database 'pubs'
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner db_datareader
STARPRINT-DEV-X\Dell pubs
pubs 42 of 46 14 January 2017 16:05:42
[db_datawriter]Schema in Database 'pubs'
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner db_datawriter
[db_ddladmin]Schema in Database 'pubs'
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner db_ddladmin
[db_denydatareader]Schema in Database 'pubs'
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner db_denydatareader
[db_denydatawriter]Schema in Database 'pubs'
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner db_denydatawriter
[db_owner]Schema in Database 'pubs'
STARPRINT-DEV-X\Dell pubs
pubs 43 of 46 14 January 2017 16:05:42
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner db_owner
[db_securityadmin]Schema in Database 'pubs'
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner db_securityadmin
[dbo]Schema in Database 'pubs'
Owned ObjectsName Typeauthors Tablebyroyalty StoredProcedurediscounts Tableempid UserDefinedDataTypeemployee Tableemployee_insupd TriggerEventNotificationErrorsQueue ServiceQueueid UserDefinedDataTypejobs Tablepub_info Tablepublishers TableQueryNotificationErrorsQueue ServiceQueuereptq1 StoredProcedurereptq2 StoredProcedurereptq3 StoredProcedureroysched Tablesales TableServiceBrokerQueue ServiceQueuestores Tabletid UserDefinedDataTypetitleauthor Tabletitles Tabletitleview View
Explicit Permissions:None
STARPRINT-DEV-X\Dell pubs
pubs 44 of 46 14 January 2017 16:05:42
PropertiesProperty ValueOwner dbo
[guest]Schema in Database 'pubs'
Owned ObjectsNone
Explicit Permissions:None
PropertiesProperty ValueOwner guest
[INFORMATION_SCHEMA]Schema in Database 'pubs'
Owned ObjectsName TypeCHECK_CONSTRAINTS ViewCOLUMN_DOMAIN_USAGE ViewCOLUMN_PRIVILEGES ViewCOLUMNS ViewCONSTRAINT_COLUMN_USAGE ViewCONSTRAINT_TABLE_USAGE ViewDOMAIN_CONSTRAINTS ViewDOMAINS ViewKEY_COLUMN_USAGE ViewPARAMETERS ViewREFERENTIAL_CONSTRAINTS ViewROUTINE_COLUMNS ViewROUTINES ViewSCHEMATA ViewSEQUENCES ViewTABLE_CONSTRAINTS ViewTABLE_PRIVILEGES ViewTABLES ViewVIEW_COLUMN_USAGE ViewVIEW_TABLE_USAGE ViewVIEWS View
Explicit Permissions:None
PropertiesProperty ValueOwner INFORMATION_SCHEMA
[sys]Schema in Database 'pubs'
STARPRINT-DEV-X\Dell pubs
pubs 45 of 46 14 January 2017 16:05:42
Owned Objects
Explicit Permissions:None
PropertiesProperty ValueOwner sys
Index
pubs 46 of 46 14 January 2017 16:05:44
Aaddress, 7advance, 28au_fname, 7au_id, 7, 26au_lname, 7, 30au_ord, 26, 30auidind, 27aunmind, 8authors, 7, 26, 43
Bbyroyalty, 31, 43
CCHECK_CONSTRAINTS, 44city, 7, 18, 24CK__authors__au_id__239E4DCF, 8CK__authors__zip__25869641, 8CK__jobs__max_lvl__403A8C7D, 14CK__jobs__min_lvl__3F466844, 15CK__publisher__pub_i__286302EC, 18CK_emp_id, 13COLUMN_DOMAIN_USAGE, 44COLUMN_PRIVILEGES, 44COLUMNS, 44CONSTRAINT_COLUMN_USAGE, 44CONSTRAINT_TABLE_USAGE, 44contract, 7country, 18
Ddb_accessadmin, 37, 38, 41db_backupoperator, 38, 41db_datareader, 38, 41db_datawriter, 38, 39, 42db_ddladmin, 39, 42db_denydatareader, 39, 42db_denydatawriter, 39, 40, 42db_owner, 36, 40, 42db_securityadmin, 40, 43dbo, 36, 40, 43discount, 9discounts, 9, 43discounttype, 9DOMAIN_CONSTRAINTS, 44DOMAINS, 44
Eemp_id, 11empid, 34, 43employee, 11, 12, 43employee_ind, 13employee_insupd, 12, 43EventNotificationErrorsQueue, 43
FFK__discounts__stor___3B75D760, 9FK__employee__job_id__47DBAE45, 11FK__employee__pub_id__4AB81AF0, 11FK__pub_info__pub_id__4316F928, 16FK__roysched__title___398D8EEE, 20FK__sales__stor_id__36B12243, 22FK__sales__title_id__37A5467C, 22FK__titleauth__au_id__30F848ED, 26
FK__titleauth__title__31EC6D26, 26FK__titles__pub_id__2D27B809, 28fname, 11
Gguest, 36, 44
Hhighqty, 9hirange, 20hire_date, 11
Iid, 35, 43INFORMATION_SCHEMA, 37, 44
Jjob_desc, 14job_id, 11, 14job_lvl, 11jobs, 11, 14, 43
KKEY_COLUMN_USAGE, 44
Llname, 11logo, 16lorange, 20lowqty, 9
Mmax_lvl, 14Microsoft.SqlServer.Types, 34, 37min_lvl, 14minit, 11
Nnotes, 28
Oord_date, 22ord_num, 22
PPARAMETERS, 44payterms, 22phone, 7PK__jobs__6E32B6A571385938, 14PK_emp_id, 11, 13pr_info, 16price, 28, 30pub_id, 11, 16, 18, 28, 30pub_info, 16, 43pub_name, 18pubdate, 28public, 41publishers, 12, 16, 18, 29, 43pubs, 4
Qqty, 22QueryNotificationErrorsQueue, 43
RREFERENTIAL_CONSTRAINTS, 44
reptq1, 32, 43reptq2, 33, 43reptq3, 34, 43ROUTINE_COLUMNS, 44ROUTINES, 44royalty, 20, 28royaltyper, 26roysched, 20, 43
Ssales, 22, 23, 43SCHEMATA, 44SEQUENCES, 44ServiceBrokerQueue, 43state, 7, 18, 24stor_address, 24stor_id, 9, 22, 24stor_name, 24stores, 9, 22, 24, 43sys, 37, 44
TTABLE_CONSTRAINTS, 44TABLE_PRIVILEGES, 44TABLES, 44tid, 35, 43title, 28, 30title_id, 20, 22, 26, 28titleauthor, 26, 43titleidind, 20, 23, 27titleind, 29titles, 20, 23, 27, 28, 43titleview, 30, 43type, 28
UUPK_storeid, 24UPKCL_auidind, 7, 8UPKCL_pubind, 18UPKCL_pubinfo, 16, 17UPKCL_sales, 22, 23UPKCL_taind, 26, 27UPKCL_titleidind, 28, 29
VVIEW_COLUMN_USAGE, 44VIEW_TABLE_USAGE, 44VIEWS, 44
Yytd_sales, 28, 30
Zzip, 7, 24