ScrewTurn Wiki
Navigation
Main Page
Random Page
Create a new Page
All Pages
Categories
Administration
File Management
Login/Logout
Language Selection
Your Profile
Create Account
Quick Search
Advanced Search »
Back
History
Sales.Store_(table)
== wikibot == {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- valign="top" | '''Table''' | Sales.Store |- valign="top" | '''Description''' | Customers (resellers) of Adventure Works products. |} === Columns === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Column''' | '''Data Type''' | '''Nullable''' | '''Default''' | '''Description''' |- valign="top" | CustomerID | int | not null | | Primary key. Foreign key to Customer.CustomerID. |- valign="top" | Name | dbo.Name | not null | | Name of the store. |- valign="top" | SalesPersonID | int | null | | ID of the sales person assigned to the customer. Foreign key to SalesPerson.SalesPersonID. |- valign="top" | Demographics | xml | null | | Demographic informationg about the store such as the number of employees, annual sales and store type. |- valign="top" | rowguid | uniqueidentifier | not null | (newid()) | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample. |- valign="top" | ModifiedDate | datetime | not null | (getdate()) | Date and time the record was last updated. |} === Primary Key === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Primary Key''' | '''Columns''' |- valign="top" | PK_Store_CustomerID | CustomerID |} === Indexes === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Index''' | '''Type''' | '''Columns''' |- valign="top" | AK_Store_rowguid | Unique | rowguid |- valign="top" | IX_Store_SalesPersonID | | SalesPersonID |- valign="top" | PXML_Store_Demographics | | Demographics |} === Foreign Keys === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Relation''' | '''Column''' | '''Referenced Column''' |- valign="top" | [[Sales.Customer_(table)|Sales.Customer]] | CustomerID | CustomerID |- valign="top" | [[Sales.SalesPerson_(table)|Sales.SalesPerson]] | SalesPersonID | SalesPersonID |} === Detail Tables === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Detail Table''' | '''Column''' | '''Referencing Column''' |- valign="top" | [[Sales.StoreContact_(table)|Sales.StoreContact]] | CustomerID | CustomerID |} === Triggers === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Trigger''' | '''Type''' |- valign="top" | iStore | ON INSERT |} ==== Trigger iStore ==== {{{{<nowiki> CREATE TRIGGER [Sales].[iStore] ON [Sales].[Store] AFTER INSERT AS BEGIN DECLARE @Count int; SET @Count = @@ROWCOUNT; IF @Count = 0 RETURN; SET NOCOUNT ON; BEGIN TRY -- Only allow the Customer to be a Store OR Individual IF EXISTS (SELECT * FROM inserted INNER JOIN [Sales].[Individual] ON inserted.[CustomerID] = [Sales].[Individual].[CustomerID]) BEGIN -- Rollback any active or uncommittable transactions IF @@TRANCOUNT > 0 BEGIN ROLLBACK TRANSACTION; END END; END TRY BEGIN CATCH EXECUTE [dbo].[uspPrintError]; -- Rollback any active or uncommittable transactions before -- inserting information in the ErrorLog IF @@TRANCOUNT > 0 BEGIN ROLLBACK TRANSACTION; END EXECUTE [dbo].[uspLogError]; END CATCH; END; </nowiki>}}}} === References === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Dependency Type''' | '''Object Type''' | '''Referenced Object''' | '''Child Type''' | '''Child Object''' |- valign="top" | Data Type | Type | [[dbo.Name_(type)|dbo.Name]] | | |- valign="top" | Schema | Schema | [[Sales_(schema)|Sales]] | | |- valign="top" | Data Type | XML Schema Collection | [[Sales.StoreSurveySchemaCollection_(xml schema collection)|Sales.StoreSurveySchemaCollection]] | | |- valign="top" | Select | Table | [[Sales.Individual_(table)|Sales.Individual]] | Trigger | iStore |- valign="top" | Execute | Procedure | [[dbo.uspLogError_(procedure)|dbo.uspLogError]] | Trigger | iStore |- valign="top" | Execute | Procedure | [[dbo.uspPrintError_(procedure)|dbo.uspPrintError]] | Trigger | iStore |} === Dependencies === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Reference Type''' | '''Object Type''' | '''Referencing Object''' | '''Child Type''' | '''Child Object''' |- valign="top" | Select | View | [[Sales.vStoreWithDemographics_(view)|Sales.vStoreWithDemographics]] | | |- valign="top" | Select | Table | [[Sales.Individual_(table)|Sales.Individual]] | Trigger | iuIndividual |} == automatically generated == {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- | '''Table''' | Sales.Store |- valign="top" | '''Description''' | Customers (resellers) of Adventure Works products. |- |- |} {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Column''' | '''Data Type''' | '''Nullable''' | '''Default''' | '''Description / PK / Index''' |- | CustomerID | int | not null | | Primary key. Foreign key to Customer.CustomerID.<br />PK_Store_CustomerID |- | Name | Name | not null | | Name of the store.<br /> |- | SalesPersonID | int | null | | ID of the sales person assigned to the customer. Foreign key to SalesPerson.SalesPersonID.<br />IX_Store_SalesPersonID |- | Demographics | XML | null | | Demographic informationg about the store such as the number of employees, annual sales and store type.<br />PXML_Store_Demographics |- | rowguid | uniqueidentifier | not null | (NEWID()) | ROWGUIDCOL number uniquely identifying the record. Used to support a merge replication sample.<br />AK_Store_rowguid |- | ModifiedDate | datetime | not null | (GETDATE()) | Date and time the record was last updated.<br /> |} {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Relation''' | '''Column''' | '''Referenced Column''' |- | [[Sales.Customer_(table)|Sales.Customer]] | CustomerID | CustomerID |- | [[Sales.SalesPerson_(table)|Sales.SalesPerson]] | SalesPersonID | SalesPersonID |} {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Detail Table''' | '''Column''' | '''Referencing Column''' |- | [[Sales.StoreContact_(table)|Sales.StoreContact]] | CustomerID | CustomerID |} {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Triggers''' | '''Type''' |- | iStore | ON INSERT |} {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Dependency Type''' | '''Object Type''' | '''Referenced Object''' | '''Child Type''' | '''Child Object''' |- | Data Type | Type | [[dbo.Name_(type)|dbo.Name]] |- | Schema | Schema | [[Sales_(schema)|Sales]] |- | Data Type | XML Schema Collection | [[Sales.StoreSurveySchemaCollection_(xml_schema_collection)|Sales.StoreSurveySchemaCollection]] |- | Select | Table | [[Sales.Individual_(table)|Sales.Individual]] | Trigger | iStore |- | Execute | Procedure | [[dbo.uspLogError_(procedure)|dbo.uspLogError]] | Trigger | iStore |- | Execute | Procedure | [[dbo.uspPrintError_(procedure)|dbo.uspPrintError]] | Trigger | iStore |} {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Reference Type''' | '''Object Type''' | '''Referencing Object''' | '''Child Type''' | '''Child Object''' |- | Select | View | [[Sales.vStoreWithDemographics_(view)|Sales.vStoreWithDemographics]] |- | Select | Table | [[Sales.Individual_(table)|Sales.Individual]] | Trigger | iuIndividual |}
ScrewTurn Wiki version 2.0.36. Some of the icons created by
FamFamFam
.