Skip to content

Commit 10fbdd9

Browse files
authored
Merge pull request #20632 from AndreasWolter/patch-20
explicit schema and avoiding "my"-style
2 parents 9a5e22a + 5912c1b commit 10fbdd9

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

docs/relational-databases/system-stored-procedures/sp-addlinkedserver-transact-sql.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,31 +295,31 @@ EXEC sp_addlinkedserver
295295
-- Configure the linked server
296296
-- Add one Azure SQL Database as Linked Server
297297
EXEC sp_addlinkedserver
298-
@server='myLinkedServer', -- here you can specify the name of the linked server
298+
@server='LinkedServerName', -- here you can specify the name of the linked server
299299
@srvproduct='',
300300
@provider='sqlncli', -- using SQL Server Native Client
301-
@datasrc='myServer.database.windows.net', -- add here your server name
301+
@datasrc='ServerName.database.windows.net', -- add here your server name
302302
@location='',
303303
@provstr='',
304-
@catalog='myDatabase' -- add here your database name as initial catalog (you cannot connect to the master database)
304+
@catalog='DatabaseName' -- add here your database name as initial catalog (you cannot connect to the master database)
305305

306306
-- Add credentials and options to this linked server
307307
EXEC sp_addlinkedsrvlogin
308-
@rmtsrvname = 'myLinkedServer',
308+
@rmtsrvname = 'LinkedServerName',
309309
@useself = 'false',
310-
@rmtuser = 'myLogin', -- add here your login on Azure DB
310+
@rmtuser = 'LoginName', -- add here your login on Azure DB
311311
@rmtpassword = 'myPassword' -- add here your password on Azure DB
312312

313-
EXEC sp_serveroption 'myLinkedServer', 'rpc out', true;
313+
EXEC sp_serveroption 'LinkedServerName', 'rpc out', true;
314314

315315
-- Now you can use the linked server to execute 4-part queries
316316
-- You can create a new table in the Azure DB
317-
EXEC ('CREATE TABLE t1tutut2(col1 int not null CONSTRAINT PK_col1 PRIMARY KEY CLUSTERED (col1) )') at myLinkedServer
317+
EXEC ('CREATE TABLE SchemaName.TableName(col1 int not null CONSTRAINT PK_col1 PRIMARY KEY CLUSTERED (col1) )') at LinkedServerName
318318
-- Insert data from your local SQL Server
319-
EXEC ('INSERT INTO t1tutut2 VALUES(1),(2),(3)') at myLinkedServer
319+
EXEC ('INSERT INTO SchemaName.TableName VALUES(1),(2),(3)') at LinkedServerName
320320

321321
-- Query the data using 4-part names
322-
SELECT * FROM myLinkedServer.myDatabase.dbo.myTable
322+
SELECT * FROM LinkedServerName.DatabaseName.SchemaName.TableName
323323
```
324324

325325
### H. Create SQL Managed Instance linked server with managed identity Azure AD authentication

0 commit comments

Comments
 (0)