Editing Purchasing.Vendor (table)

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 2: Line 2:
  
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
|- valign="top"
+
|-
 
| '''Table
 
| '''Table
 
| Purchasing.Vendor
 
| 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"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
|- style="background:silver"
Line 17: Line 15:
 
| '''Nullable
 
| '''Nullable
 
| '''Default
 
| '''Default
| '''Description
+
| '''PK
 
+
| '''Index
|- valign="top"
+
 +
|-
 
| VendorID
 
| VendorID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
| Primary key for Vendor records.
+
| PK_Vendor_VendorID
|- valign="top"
+
|
 +
|-
 
| AccountNumber
 
| AccountNumber
 
| dbo.AccountNumber
 
| dbo.AccountNumber
 
| not null
 
| not null
 
|  
 
|  
| Vendor account (identification) number.
+
|  
|- valign="top"
+
| AK_Vendor_AccountNumber
 +
|-
 
| Name
 
| Name
 
| dbo.Name
 
| dbo.Name
 
| not null
 
| not null
 
|  
 
|  
| Company name.
+
|  
|- valign="top"
+
|
 +
|-
 
| CreditRating
 
| CreditRating
 
| tinyint
 
| tinyint
 
| not null
 
| not null
 
|  
 
|  
| 1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average
+
|  
|- valign="top"
+
|
 +
|-
 
| PreferredVendorStatus
 
| PreferredVendorStatus
 
| dbo.Flag
 
| dbo.Flag
 
| not null
 
| not null
 
| ((1))
 
| ((1))
| 0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product.
+
|  
|- valign="top"
+
|
 +
|-
 
| ActiveFlag
 
| ActiveFlag
 
| dbo.Flag
 
| dbo.Flag
 
| not null
 
| not null
 
| ((1))
 
| ((1))
| 0 = Vendor no longer used. 1 = Vendor is actively used.
+
|  
|- valign="top"
+
|
 +
|-
 
| PurchasingWebServiceURL
 
| PurchasingWebServiceURL
 
| nvarchar(1024)
 
| nvarchar(1024)
 
| null
 
| null
 
|  
 
|  
| Vendor URL.
+
|  
|- valign="top"
+
|
 +
|-
 
| ModifiedDate
 
| ModifiedDate
 
| datetime
 
| datetime
 
| not null
 
| not null
 
| (getdate())
 
| (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"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
|- style="background:silver"
Line 111: Line 83:
 
| '''Column
 
| '''Column
 
| '''Referencing Column
 
| '''Referencing Column
 
+
|- valign="top"
+
|-
 
| [[Purchasing.ProductVendor_(table)|Purchasing.ProductVendor]]
 
| [[Purchasing.ProductVendor_(table)|Purchasing.ProductVendor]]
 
| VendorID
 
| VendorID
 
| VendorID
 
| VendorID
|- valign="top"
+
|-
 
| [[Purchasing.PurchaseOrderHeader_(table)|Purchasing.PurchaseOrderHeader]]
 
| [[Purchasing.PurchaseOrderHeader_(table)|Purchasing.PurchaseOrderHeader]]
 
| VendorID
 
| VendorID
 
| VendorID
 
| VendorID
|- valign="top"
+
|-
 
| [[Purchasing.VendorAddress_(table)|Purchasing.VendorAddress]]
 
| [[Purchasing.VendorAddress_(table)|Purchasing.VendorAddress]]
 
| VendorID
 
| VendorID
 
| VendorID
 
| VendorID
|- valign="top"
+
|-
 
| [[Purchasing.VendorContact_(table)|Purchasing.VendorContact]]
 
| [[Purchasing.VendorContact_(table)|Purchasing.VendorContact]]
 
| VendorID
 
| VendorID
Line 130: Line 102:
 
|}
 
|}
  
=== Triggers ===
+
 
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
|- style="background:silver"
| '''Trigger
+
| '''Triggers
 
| '''Type
 
| '''Type
 
+
|- valign="top"
+
|-
 
| dVendor
 
| dVendor
 
| INSTEAD OF DELETE
 
| INSTEAD OF DELETE
 
|}
 
|}
 
==== Trigger dVendor ====
 
<pre>
 
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;
 
</pre>
 
 
=== 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]]
 
 
|}
 
 
  
 
== automatically generated ==
 
== automatically generated ==
Line 262: Line 119:
 
| '''Table
 
| '''Table
 
| Purchasing.Vendor
 
| Purchasing.Vendor
|- valign="top"
+
|-
 +
 
 
| '''Description
 
| '''Description
 
| Companies from whom Adventure Works Cycles purchases parts or other goods.
 
| Companies from whom Adventure Works Cycles purchases parts or other goods.
 
|-
 
|-
 +
 
|}
 
|}
  
Line 275: Line 134:
 
| '''Nullable
 
| '''Nullable
 
| '''Default
 
| '''Default
| '''Description / PK / Index
+
| '''Description
 +
| '''PK / Index
 
 
|- valign="top"
+
|-
 
| VendorID
 
| VendorID
 
| int
 
| int
 
| not null
 
| not null
 
|  
 
|  
| Primary key for Vendor records.<br />PK_Vendor_VendorID
+
| Primary key for Vendor records.
|- valign="top"
+
| PK_Vendor_VendorID
 +
|-
 
| AccountNumber
 
| AccountNumber
 
| AccountNumber
 
| AccountNumber
 
| not null
 
| not null
 
|  
 
|  
| Vendor account (identification) number.<br />AK_Vendor_AccountNumber
+
| Vendor account (identification) number.
|- valign="top"
+
| AK_Vendor_AccountNumber
 +
|-
 
| Name
 
| Name
 
| Name
 
| Name
 
| not null
 
| not null
 
|  
 
|  
| Company name.<br />
+
| Company name.
|- valign="top"
+
|
 +
|-
 
| CreditRating
 
| CreditRating
 
| tinyint
 
| tinyint
 
| not null
 
| not null
 
|  
 
|  
| 1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average<br />
+
| 1 = Superior, 2 = Excellent, 3 = Above average, 4 = Average, 5 = Below average
|- valign="top"
+
|
 +
|-
 
| PreferredVendorStatus
 
| PreferredVendorStatus
 
| Flag
 
| Flag
 
| not null
 
| not null
 
| (1)
 
| (1)
| 0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product.<br />
+
| 0 = Do not use if another vendor is available. 1 = Preferred over other vendors supplying the same product.
|- valign="top"
+
|
 +
|-
 
| ActiveFlag
 
| ActiveFlag
 
| Flag
 
| Flag
 
| not null
 
| not null
 
| (1)
 
| (1)
| 0 = Vendor no longer used. 1 = Vendor is actively used.<br />
+
| 0 = Vendor no longer used. 1 = Vendor is actively used.
|- valign="top"
+
|
 +
|-
 
| PurchasingWebServiceURL
 
| PurchasingWebServiceURL
 
| nvarchar(1024)
 
| nvarchar(1024)
 
| null
 
| null
 
|  
 
|  
| Vendor URL.<br />
+
| Vendor URL.
|- valign="top"
+
|
 +
|-
 
| ModifiedDate
 
| ModifiedDate
 
| datetime
 
| datetime
 
| not null
 
| not null
 
| (GETDATE())
 
| (GETDATE())
| Date and time the record was last updated.<br />
+
| Date and time the record was last updated.
 +
|
 
|}
 
|}
  
Line 362: Line 230:
 
| dVendor
 
| dVendor
 
| INSTEAD OF DELETE
 
| INSTEAD OF DELETE
|}
 
 
 
{| 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.AccountNumber_(type)|dbo.AccountNumber]]
 
 
|
 
|
 
|-
 
| Data Type
 
| Type
 
| [[dbo.Flag_(type)|dbo.Flag]]
 
 
|
 
|
 
|-
 
| Data Type
 
| Type
 
| [[dbo.Name_(type)|dbo.Name]]
 
 
|
 
|
 
|-
 
| Schema
 
| Schema
 
| [[Purchasing_(schema)|Purchasing]]
 
 
|
 
|
 
|-
 
| Execute
 
| Procedure
 
| [[dbo.uspLogError_(procedure)|dbo.uspLogError]]
 
 
| Trigger
 
| dVendor
 
|-
 
| Execute
 
| Procedure
 
| [[dbo.uspPrintError_(procedure)|dbo.uspPrintError]]
 
 
| Trigger
 
| dVendor
 
|}
 
 
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
| '''Reference Type
 
| '''Object Type
 
| '''Referencing Object
 
 
|-
 
| Select
 
| View
 
| [[Purchasing.vVendor_(view)|Purchasing.vVendor]]
 
 
 
|}
 
|}

Please note that all contributions to dbscript Online Help may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Project:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)