Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit 07f14d1

Browse files
authored
Merge pull request #8499 from douglaslMS/tsql-update-1350
Updated incorrect example to fix issue #1350.
2 parents fa73c9f + 021804a commit 07f14d1

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

docs/t-sql/queries/update-transact-sql.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ GO
321321

322322
If the UPDATE statement could change more than one row while updating both the clustering key and one or more **text**, **ntext**, or **image** columns, the partial update to these columns is executed as a full replacement of the values.
323323

324-
> [!IMPORTANT]
324+
> [!IMPORTANT]
325325
> The **ntext**, **text**, and **image** data types will be removed in a future version of [!INCLUDE[msCoName](../../includes/msconame-md.md)][!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use [nvarchar(max)](../../t-sql/data-types/nchar-and-nvarchar-transact-sql.md), [varchar(max)](../../t-sql/data-types/char-and-varchar-transact-sql.md), and [varbinary(max)](../../t-sql/data-types/binary-and-varbinary-transact-sql.md) instead.
326326
327327
### Updating Large Value Data Types
@@ -756,15 +756,15 @@ GO
756756
Examples in this section demonstrate how to update rows in a remote target table by using a [linked server](../../relational-databases/system-stored-procedures/sp-addlinkedserver-transact-sql.md) or a [rowset function](../../t-sql/functions/rowset-functions-transact-sql.md) to reference the remote table.
757757

758758
#### O. Updating data in a remote table by using a linked server
759-
The following example updates a table on a remote server. The example begins by creating a link to the remote data source by using [sp_addlinkedserver](../../relational-databases/system-stored-procedures/sp-addlinkedserver-transact-sql.md). The linked server name, `MyLinkServer`, is then specified as part of the four-part object name in the form server.catalog.schema.object. Note that you must specify a valid server name for `@datasrc`.
759+
The following example updates a table on a remote server. The example begins by creating a link to the remote data source by using [sp_addlinkedserver](../../relational-databases/system-stored-procedures/sp-addlinkedserver-transact-sql.md). The linked server name, `MyLinkedServer`, is then specified as part of the four-part object name in the form server.catalog.schema.object. Note that you must specify a valid server name for `@datasrc`.
760760

761761
```sql
762762
USE master;
763763
GO
764764
-- Create a link to the remote data source.
765765
-- Specify a valid server name for @datasrc as 'server_name' or 'server_nameinstance_name'.
766766

767-
EXEC sp_addlinkedserver @server = N'MyLinkServer',
767+
EXEC sp_addlinkedserver @server = N'MyLinkedServer',
768768
@srvproduct = N' ',
769769
@provider = N'SQLNCLI10',
770770
@datasrc = N'<server name>',
@@ -775,7 +775,7 @@ GO
775775
-- Specify the remote data source using a four-part name
776776
-- in the form linked_server.catalog.schema.object.
777777

778-
UPDATE MyLinkServer.AdventureWorks2012.HumanResources.Department
778+
UPDATE MyLinkedServer.AdventureWorks2012.HumanResources.Department
779779
SET GroupName = N'Public Relations'
780780
WHERE DepartmentID = 4;
781781
```
@@ -784,18 +784,18 @@ WHERE DepartmentID = 4;
784784
The following example updates a row in a remote table by specifying the [OPENQUERY](../../t-sql/functions/openquery-transact-sql.md) rowset function. The linked server name created in the previous example is used in this example.
785785

786786
```sql
787-
UPDATE OPENQUERY (MyLinkServer, 'SELECT GroupName FROM HumanResources.Department WHERE DepartmentID = 4')
787+
UPDATE OPENQUERY (MyLinkedServer, 'SELECT GroupName FROM HumanResources.Department WHERE DepartmentID = 4')
788788
SET GroupName = 'Sales and Marketing';
789789
```
790790

791791
#### Q. Updating data in a remote table by using the OPENDATASOURCE function
792-
The following example inserts a row into a remote table by specifying the [OPENDATASOURCE](../../t-sql/functions/opendatasource-transact-sql.md) rowset function. Specify a valid server name for the data source by using the format *server_name* or *server_name\instance_name*. You may need to configure the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] for Ad Hoc Distributed Queries. For more information, see [ad hoc distributed queries Server Configuration Option](../../database-engine/configure-windows/ad-hoc-distributed-queries-server-configuration-option.md).
793-
794-
```sql
795-
UPDATE OPENQUERY (MyLinkServer, 'SELECT GroupName FROM HumanResources.Department WHERE DepartmentID = 4')
796-
SET GroupName = 'Sales and Marketing';
797-
```
798-
792+
The following example updates a row in a remote table by specifying the [OPENDATASOURCE](../../t-sql/functions/opendatasource-transact-sql.md) rowset function. Specify a valid server name for the data source by using the format *server_name* or *server_name\instance_name*. You may need to configure the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] for Ad Hoc Distributed Queries. For more information, see [ad hoc distributed queries Server Configuration Option](../../database-engine/configure-windows/ad-hoc-distributed-queries-server-configuration-option.md).
793+
794+
```sql
795+
UPDATE OPENDATASOURCE('SQLNCLI', 'Data Source=<server name>;Integrated Security=SSPI').AdventureWorks2012.HumanResources.Department
796+
SET GroupName = 'Sales and Marketing' WHERE DepartmentID = 4;
797+
```
798+
799799
### <a name="LOBValues"></a> Updating Large Object Data Types
800800
Examples in this section demonstrate methods of updating values in columns that are defined with large object (LOB) data types.
801801

0 commit comments

Comments
 (0)