Welcome
Guest
, you are in:
<root>
•
Login
devio dbscript ScrewTurn Wiki
Navigation
¶
Main Page
Random Page
Create a new Page
All Pages
Categories
Navigation Paths
Administration
File Management
Create Account
Search the wiki
»
Back
Sales Store (table)
Modified on 2011/08/27 11:19
by
wikibot
Categorized as
Uncategorized
== 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 |}
ScrewTurn Wiki
version 3.0.1.400. Some of the icons created by
FamFamFam
.