Jaa


ForeignKey Members

The ForeignKey object represents a Microsoft SQL Server foreign key.

The following tables list the members exposed by the ForeignKey type.

Public Constructors

  Name Description
ForeignKey Overloaded. Initializes a new instance of the ForeignKey class.

Top

Protected Fields

  Name Description
ms219530.protfield(en-US,SQL.90).gif m_ExtendedProperties  (inherited from SqlSmoObject )

Top

Public Properties

(see also Protected Properties )

  Name Description
ms219530.pubproperty(en-US,SQL.90).gif Columns Represents a collection of Column objects. Each Column object represents a column included in the foreign key.
ms219530.pubproperty(en-US,SQL.90).gif CreateDate Gets the date and time when the foreign key was created.
ms219530.pubproperty(en-US,SQL.90).gif DateLastModified Gets the date and time when the foreign key was last modified.
ms219530.pubproperty(en-US,SQL.90).gif DeleteAction Gets or sets the action taken when the row that is referenced by the foreign key is deleted.
ms219530.pubproperty(en-US,SQL.90).gif ExtendedProperties Represents a collection of ExtendedProperty objects. Each ExtendedProperty object represents an extended property on the ForeignKey object.
ms219530.pubproperty(en-US,SQL.90).gif ID Gets the ID value that uniquely identifies the foreign key.
ms219530.pubproperty(en-US,SQL.90).gif IsChecked Gets or sets the Boolean property value that specifies whether the foreign key constraint was enabled without checking existing rows.
ms219530.pubproperty(en-US,SQL.90).gif IsEnabled Gets or sets the Boolean property value that specifies whether the foreign key is enabled.
ms219530.pubproperty(en-US,SQL.90).gif IsSystemNamed Gets the Boolean property value that specifies whether the foreign key is named by the system or by the user.
ms219530.pubproperty(en-US,SQL.90).gif Name  Gets or sets the name of the object. (inherited from NamedSmoObject)
ms219530.pubproperty(en-US,SQL.90).gif NotForReplication Gets the Boolean property value that specifies whether the foreign key is available for replication.
ms219530.pubproperty(en-US,SQL.90).gif Parent Gets or sets the Table object that is the parent of the ForeignKey object.
ms219530.pubproperty(en-US,SQL.90).gif Properties  Gets a collection of Property objects that represent the object properties. (inherited from SqlSmoObject)
ms219530.pubproperty(en-US,SQL.90).gif ReferencedKey Gets the primary key referenced by the foreign key.
ms219530.pubproperty(en-US,SQL.90).gif ReferencedTable Gets or sets the table that contains the primary key referenced by the foreign key.
ms219530.pubproperty(en-US,SQL.90).gif ReferencedTableSchema Gets or sets the table schema that contains the primary key referenced by the foreign key.
ms219530.pubproperty(en-US,SQL.90).gif ScriptReferencedTable Gets or sets the Boolean value that specifies whether to script the table referenced by the foreign key.
ms219530.pubproperty(en-US,SQL.90).gif ScriptReferencedTableSchema Gets or sets the Boolean value that specifies whether to script the schema of the table referenced by the foreign key.
ms219530.pubproperty(en-US,SQL.90).gif State  Gets the state of the referenced object. (inherited from SmoObjectBase)
ms219530.pubproperty(en-US,SQL.90).gif UpdateAction Gets or sets the Boolean property value that specifies whether the foreign key supports cascading updates.
ms219530.pubproperty(en-US,SQL.90).gif Urn  Gets the Uniform Resource Name (URN) address value that uniquely identifies the object. (inherited from SqlSmoObject)
ms219530.pubproperty(en-US,SQL.90).gif UserData  Gets or sets user-defined data associated with the referenced object. (inherited from SmoObjectBase)

Top

Protected Properties

  Name Description
ms219530.protproperty(en-US,SQL.90).gif ExecuteForScalar  Gets or sets the Boolean property value that specifies whether the object is set to the execute for scalar option. (inherited from SqlSmoObject)
ms219530.protproperty(en-US,SQL.90).gif ObjectInSpace  Gets the Boolean property value that specifies whether the object exists in isolation or whether it is connected to the instance of Microsoft SQL Server directly or indirectly. (inherited from SqlSmoObject)
ms219530.protproperty(en-US,SQL.90).gif PresetProperties  Gets or sets the preset properties of the referenced object. (inherited from SqlSmoObject)
ms219530.protproperty(en-US,SQL.90).gif ScalarResult  Gets the scalar result for the referenced object. (inherited from SqlSmoObject)

Top

Public Methods

(see also Protected Methods )

  Name Description
ms219530.pubmethod(en-US,SQL.90).gif Alter Updates any ForeignKey object property changes on instance of Microsoft SQL Server.
ms219530.pubmethod(en-US,SQL.90).gif Create Creates a foreign key on the instance of Microsoft SQL Server as defined by the ForeignKey object.
ms219530.pubmethod(en-US,SQL.90).gif Drop Drops the foreign key.
ms219530.pubmethod(en-US,SQL.90).gif Equals  Overloaded. (inherited from Object )
ms219530.pubmethod(en-US,SQL.90).gif GetHashCode  (inherited from Object )
ms219530.pubmethod(en-US,SQL.90).gif GetType  (inherited from Object )
ms219530.pubmethod(en-US,SQL.90).gif Initialize  Overloaded. Initializes the object and forces the properties be loaded. (inherited from SqlSmoObject)
ms219530.pubmethod(en-US,SQL.90).gif MarkForDrop Marks the foreign key to be dropped the next time its parent Table object is altered by the Alter method.
ms219530.pubmethod(en-US,SQL.90).gifms219530.static(en-US,SQL.90).gif ReferenceEquals  (inherited from Object )
ms219530.pubmethod(en-US,SQL.90).gif Refresh  Refreshes the script name. (inherited from ScriptNameObjectBase)
ms219530.pubmethod(en-US,SQL.90).gif Script Overloaded. Generates a Transact-SQL script that can be used to re-create the foreign key.
ms219530.pubmethod(en-US,SQL.90).gif ToString  Returns a String that represents the referenced object. (inherited from SqlSmoObject)

Top

Protected Methods

  Name Description
ms219530.protmethod(en-US,SQL.90).gif AlterImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif AlterImplFinish  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif AlterImplInit  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif AlterImplWorker  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif AppendCommaText  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif AppendWithCommaText  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif AppendWithOption  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif BindDefaultImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif BindRuleImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif CheckCollation  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif CheckObjectState  Overloaded. Validates the state of the referenced object. (inherited from SqlSmoObject)
ms219530.protmethod(en-US,SQL.90).gif CheckObjectStateImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif CheckTextCorectness  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif CheckTextModeSupport  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif CheckVersion80  Checks the validity of the object on Microsoft SQL Server 2000. (inherited from SqlSmoObject)
ms219530.protmethod(en-US,SQL.90).gif CheckVersion80SP3  Checks the validity of the object on Microsoft SQL Server 2000 SP3. (inherited from SqlSmoObject)
ms219530.protmethod(en-US,SQL.90).gif CheckVersion90  Check the validity of the object on Microsoft SQL Server 2005. (inherited from SqlSmoObject)
ms219530.protmethod(en-US,SQL.90).gif CheckVersionBelow90  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif CleanObject  Cleans the referenced object. (inherited from ScriptNameObjectBase)
ms219530.protmethod(en-US,SQL.90).gif CreateImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif CreateImplFinish  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif CreateImplInit  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif DropImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif DropImplWorker  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif Finalize  (inherited from Object )
ms219530.protmethod(en-US,SQL.90).gif ForceTextModeOnTextBody  Enforces text mode on the text body. (inherited from ScriptNameObjectBase)
ms219530.protmethod(en-US,SQL.90).gif FormatSqlVariant  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GenerateDataSpaceScript  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetBindDefaultScript  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetBindRuleScript  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetBoolParameter  Overloaded. (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetBraketNameForText  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif GetDateTimeParameter  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetDateTimeParameterAsInt  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetDBName  Gets the database name associated with the object. (inherited from SqlSmoObject)
ms219530.protmethod(en-US,SQL.90).gif GetEnumParameter  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetFragOptionString  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetGuidParameter  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetIsTextDirty  Determines whether the text value is consistent with stored value. (inherited from ScriptNameObjectBase)
ms219530.protmethod(en-US,SQL.90).gif GetParameter  Overloaded. (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetPropValue  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetPropValueOptional  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetPropValueOptionalAllowNull  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetRealValue  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetScriptIncludeExists  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif GetScriptingOptionsForCreate  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetServerName  Gets the name of the instance of Microsoft SQL Server with which the object is associated. (inherited from SqlSmoObject)
ms219530.protmethod(en-US,SQL.90).gif GetSqlServerVersionName  Gets the version name of the instance of Microsoft SQL Server with which the object is associated. (inherited from SqlSmoObject)
ms219530.protmethod(en-US,SQL.90).gif GetStringParameter  Overloaded. (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetTextBody  Overloaded. Returns the text body. (inherited from ScriptNameObjectBase)
ms219530.protmethod(en-US,SQL.90).gif GetTextForScript  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif GetTextHeader  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif GetTextMode  Determines whether the script name is using text mode. (inherited from ScriptNameObjectBase)
ms219530.protmethod(en-US,SQL.90).gif GetTextProperty  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif GetTimeSpanParameterAsInt  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif GetUrnRecursive  Overloaded. (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif ImplInitialize  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gifms219530.static(en-US,SQL.90).gif IsCollectionDirty  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif IsObjectDirty  Determines whether the referenced object is consistent with the stored object. (inherited from ScriptNameObjectBase)
ms219530.protmethod(en-US,SQL.90).gif IsObjectInitialized  Verifies whether the object has been initialized. (inherited from SqlSmoObject)
ms219530.protmethod(en-US,SQL.90).gif IsObjectInSpace  Verifies whether the object is isolated or connected to the instance of Microsoft SQL Server. (inherited from SqlSmoObject)
ms219530.protmethod(en-US,SQL.90).gif IsVersion80SP3  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif MarkDropped  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif MarkForDropImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif MemberwiseClone  (inherited from Object )
ms219530.protmethod(en-US,SQL.90).gif PostAlter  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif PostCreate  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif PostDrop  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif RenameImpl  (inherited from NamedSmoObject )
ms219530.protmethod(en-US,SQL.90).gif RenameImplWorker  (inherited from NamedSmoObject )
ms219530.protmethod(en-US,SQL.90).gif ScriptAlter  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif ScriptAnsiQI  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif ScriptChangeOwner  (inherited from NamedSmoObject )
ms219530.protmethod(en-US,SQL.90).gif ScriptCreate  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif ScriptDdl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif ScriptDrop  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif ScriptImpl  Overloaded. (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif ScriptImplWorker  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif ScriptInformativeHeaders  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif ScriptRename  (inherited from NamedSmoObject )
ms219530.protmethod(en-US,SQL.90).gif SetCollectionTextMode  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif SetParentImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif SetTextBody  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif SetTextHeader  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif SetTextMode  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif SwitchTextMode  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gif ThrowIfTextIsDirtyForAlter  (inherited from ScriptNameObjectBase )
ms219530.protmethod(en-US,SQL.90).gifms219530.static(en-US,SQL.90).gif Trace  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif UnbindDefaultImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gif UnbindRuleImpl  (inherited from SqlSmoObject )
ms219530.protmethod(en-US,SQL.90).gifms219530.static(en-US,SQL.90).gif UpdateCollectionState2  (inherited from SqlSmoObject )

Top

See Also

Reference

ForeignKey Class
Microsoft.SqlServer.Management.Smo Namespace

Other Resources

Creating, Altering, and Removing Foreign Keys
Creating and Modifying FOREIGN KEY Constraints
CREATE TABLE (Transact-SQL)