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
Purchasing Vendor (table)
Modified on 2011/08/27 11:18
by
wikibot
Categorized as
Uncategorized
== wikibot == {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- valign="top" | '''Table''' | Purchasing.Vendor |- valign="top" | '''Description''' | Companies from whom Adventure Works Cycles purchases parts or other goods. |} === Columns === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Column''' | '''Data Type''' | '''Nullable''' | '''Default''' | '''Description''' |- valign="top" | VendorID | int | not null | | Primary key for Vendor records. |- valign="top" | AccountNumber | dbo.AccountNumber | not null | | Vendor account (identification) number. |- valign="top" | Name | dbo.Name | not null | | Company name. |- valign="top" | CreditRating | tinyint | not null | | 1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average |- valign="top" | PreferredVendorStatus | dbo.Flag | not null | ((1)) | 0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product. |- valign="top" | ActiveFlag | dbo.Flag | not null | ((1)) | 0 = Vendor no longer used. 1 = Vendor is actively used. |- valign="top" | PurchasingWebServiceURL | nvarchar(1024) | null | | Vendor URL. |- 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_Vendor_VendorID | VendorID |} === Indexes === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Index''' | '''Type''' | '''Columns''' |- valign="top" | AK_Vendor_AccountNumber | Unique | AccountNumber |} === Check Constraints === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Check Constraint''' | '''Expression''' | '''Description''' |- valign="top" | CK_Vendor_CreditRating | ([CreditRating]>=(1) AND [CreditRating]<=(5)) | Check constraint [CreditRating] BETWEEN (1) AND (5) |} === Detail Tables === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Detail Table''' | '''Column''' | '''Referencing Column''' |- valign="top" | [[Purchasing ProductVendor (table)|Purchasing.ProductVendor]] | VendorID | VendorID |- valign="top" | [[Purchasing PurchaseOrderHeader (table)|Purchasing.PurchaseOrderHeader]] | VendorID | VendorID |- valign="top" | [[Purchasing VendorAddress (table)|Purchasing.VendorAddress]] | VendorID | VendorID |- valign="top" | [[Purchasing VendorContact (table)|Purchasing.VendorContact]] | VendorID | VendorID |} === Triggers === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Trigger''' | '''Type''' |- valign="top" | dVendor | INSTEAD OF DELETE |} ==== Trigger dVendor ==== {{{{<nowiki> CREATE TRIGGER [Purchasing].[dVendor] ON [Purchasing].[Vendor] INSTEAD OF DELETE NOT FOR REPLICATION AS BEGIN DECLARE @Count int; SET @Count = @@ROWCOUNT; IF @Count = 0 RETURN; SET NOCOUNT ON; BEGIN TRY DECLARE @DeleteCount int; SELECT @DeleteCount = COUNT(*) FROM deleted; IF @DeleteCount > 0 BEGIN RAISERROR (N'Vendors cannot be deleted. They can only be marked as not active.', -- Message 10, -- Severity. 1); -- State. -- 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 AccountNumber (type)|dbo.AccountNumber]] | | |- valign="top" | Data Type | Type | [[dbo Flag (type)|dbo.Flag]] | | |- valign="top" | Data Type | Type | [[dbo Name (type)|dbo.Name]] | | |- valign="top" | Schema | Schema | [[Purchasing (schema)|Purchasing]] | | |- valign="top" | Execute | Procedure | [[dbo uspLogError (procedure)|dbo.uspLogError]] | Trigger | dVendor |- valign="top" | Execute | Procedure | [[dbo uspPrintError (procedure)|dbo.uspPrintError]] | Trigger | dVendor |} === Dependencies === {| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse" |- style="background:silver" | '''Reference Type''' | '''Object Type''' | '''Referencing Object''' |- valign="top" | Select | View | [[Purchasing vVendor (view)|Purchasing.vVendor]] |}
ScrewTurn Wiki
version 3.0.1.400. Some of the icons created by
FamFamFam
.