Showing posts with label linked. Show all posts
Showing posts with label linked. Show all posts

Wednesday, March 28, 2012

Remove Cursor

Hi all,
I have a table A with 2 cols one id and the other linkedids separated with
pipe "|"
id linked ids
1 4|5|6
2 9|10|11
I want the output as without using cursors or while loop..
1 4
1 5
1 6
2 9
2 10
2 11
Your thoughts on this...
Thanks in advance,
PradeepSee this excellent article by Erland Sommarskog, SQL Server MVP:
http://www.sommarskog.se/arrays-in-sql.html
Razvan|||And my personal favourite:
http://solidqualitylearning.com/Blo.../10/22/200.aspx
ML|||This chy little solution can deal with up to four items ( three pipes ):
SET NOCOUNT ON
DROP TABLE #linked_ids
CREATE TABLE #linked_ids ( id INT PRIMARY KEY, linked_ids VARCHAR( 50 ) )
INSERT INTO #linked_ids
SELECT 1, '4|5|6|7' UNION
SELECT 2, '9|10|11|12' UNION
SELECT 3, '13|14|15|16|17'
SET NOCOUNT OFF
SELECT t.id, t.linked_ids, PARSENAME( REPLACE( t.linked_ids, '|', '.' ), 1 )
FROM #linked_ids t
UNION
SELECT t.id, t.linked_ids, PARSENAME( REPLACE( t.linked_ids, '|', '.' ), 2 )
FROM #linked_ids t
UNION
SELECT t.id, t.linked_ids, PARSENAME( REPLACE( t.linked_ids, '|', '.' ), 3 )
FROM #linked_ids t
UNION
SELECT t.id, t.linked_ids, PARSENAME( REPLACE( t.linked_ids, '|', '.' ), 4)
FROM #linked_ids t
Damien
"Pradeep Kutty" wrote:

> Hi all,
> I have a table A with 2 cols one id and the other linkedids separated with
> pipe "|"
> id linked ids
> 1 4|5|6
> 2 9|10|11
> I want the output as without using cursors or while loop..
> 1 4
> 1 5
> 1 6
> 2 9
> 2 10
> 2 11
> Your thoughts on this...
> Thanks in advance,
> Pradeep
>
>|||See: http://tinyurl.com/b3ce2
Anith

Friday, March 23, 2012

remoted linked server problem

I am running SQL 2005 trigger and update the table in remote linked server. This is working perfectly when the firewall is off. However when I turn on the firewall, it wont run any more. I need the firewall on for the security issue. How can I run this trigger with firewall on? Thanks.Do not create triggers that operate outside the scope of their own database.|||Do not create triggers that operate outside the scope of their own database.

+1

hmscott

Wednesday, March 21, 2012

Remote Stored Procedure exec from variable

Hello Folks,

I have a server that is linked to several other servers. I have been able to successfully execute a procedure manually to each from the common server by executing this:

exec server1.dbname.owner.procedure
go
exec server2.dbname.owner.procedure
go
exec server3.dbname.owner.procedure
go

While this is ok, I'd like to wrap this in a loop to execute the procedure but switch out the server name in each iteration (something like this):

while @.variable is not null
begin
select @.server = 'change name in loop'
select @.str = @.server+'.dbname.owner.procedure'
exec @.str
end

This unfortunately does not work. The execute is acting like the server portion of the name does not exist (defaulting to local). I have attempted to use the AT SERVERNAME syntax in a similar fashion and been unsuccessful.

Is there some way I could dynamically create the four part name and execute it?

Any assistance would be greatly appreciated.

Thanks, Mark

DECLARE @.server nvarchar(128)

DECLARE @.cmd nvarchar(1000)

SET @.server = 'MyServer'

SET @.cmd = 'EXEC ' + @.server + '.MyDatabase.MySchema.MySproc'

EXEC (@.cmd)

Remote stored procedure

I am trying to run a stored procedure on a remote server and insert the
output into a table on the local machine.
The two servers are linked and I am using the code as follows
BEGIN DISTRIBUTED TRAN
insert into ServerA.Database.dbo.drv_total
exec ServerB.master.dbo.xp_fixeddrives
COMMIT TRAN
The MSDTC is started on both machines.
I am getting this error:
Server: Msg 7391, Level 16, State 1, Line 2
The operation could not be performed because the OLE DB provider 'SQLOLEDB'
was unable to begin a distributed transaction.
[OLE/DB provider returned message: New transaction cannot enlist in the
specified transaction coordinator. ]
Any thoughts?
TIA,
nivek
Hi Nivek,
Are you running on Windows 2003? If so, the following link may apply to you:
http://support.microsoft.com/default...b;en-us;329332
"The problem occurs because Microsoft Distributed Transaction Coordinator
(MS DTC) is not configured for network access. By default, the network access
settings of MS DTC are disabled on new installations of SQL Server 2000 on
computers running Windows Server 2003, Enterprise Edition. "
Best Regards,
Joe Sack
Author of "SQL Server 2000 Fast Answers..."
http://www.JoeSack.com
"nivek" wrote:

> I am trying to run a stored procedure on a remote server and insert the
> output into a table on the local machine.
> The two servers are linked and I am using the code as follows
> BEGIN DISTRIBUTED TRAN
> insert into ServerA.Database.dbo.drv_total
> exec ServerB.master.dbo.xp_fixeddrives
> COMMIT TRAN
> The MSDTC is started on both machines.
> I am getting this error:
> Server: Msg 7391, Level 16, State 1, Line 2
> The operation could not be performed because the OLE DB provider 'SQLOLEDB'
> was unable to begin a distributed transaction.
> [OLE/DB provider returned message: New transaction cannot enlist in the
> specified transaction coordinator. ]
>
> Any thoughts?
>
> TIA,
> nivek
>
>
sql

Remote stored procedure

I am trying to run a stored procedure on a remote server and insert the
output into a table on the local machine.
The two servers are linked and I am using the code as follows
BEGIN DISTRIBUTED TRAN
insert into ServerA.Database.dbo.drv_total
exec ServerB.master.dbo.xp_fixeddrives
COMMIT TRAN
The MSDTC is started on both machines.
I am getting this error:
Server: Msg 7391, Level 16, State 1, Line 2
The operation could not be performed because the OLE DB provider 'SQLOLEDB'
was unable to begin a distributed transaction.
[OLE/DB provider returned message: New transaction cannot enlist in the
specified transaction coordinator. ]
Any thoughts?
TIA,
nivekHi Nivek,
Are you running on Windows 2003? If so, the following link may apply to you:
http://support.microsoft.com/default.aspx?scid=kb;en-us;329332
"The problem occurs because Microsoft Distributed Transaction Coordinator
(MS DTC) is not configured for network access. By default, the network access
settings of MS DTC are disabled on new installations of SQL Server 2000 on
computers running Windows Server 2003, Enterprise Edition. "
Best Regards,
Joe Sack
Author of "SQL Server 2000 Fast Answers..."
http://www.JoeSack.com
"nivek" wrote:
> I am trying to run a stored procedure on a remote server and insert the
> output into a table on the local machine.
> The two servers are linked and I am using the code as follows
> BEGIN DISTRIBUTED TRAN
> insert into ServerA.Database.dbo.drv_total
> exec ServerB.master.dbo.xp_fixeddrives
> COMMIT TRAN
> The MSDTC is started on both machines.
> I am getting this error:
> Server: Msg 7391, Level 16, State 1, Line 2
> The operation could not be performed because the OLE DB provider 'SQLOLEDB'
> was unable to begin a distributed transaction.
> [OLE/DB provider returned message: New transaction cannot enlist in the
> specified transaction coordinator. ]
>
> Any thoughts?
>
> TIA,
> nivek
>
>

Remote Stored Proc Call

I'm calling this from another sql server...
I created a linked server... and want to restore database backups on the other box...
The restore script runs fine when ran locally but fails with the message below when calling it remotely

Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.
Server: Msg 3101, Level 16, State 1, Line 1
Exclusive access could not be obtained because the database is in use.

CREATE PROCEDURE usp_restore_database_backups AS

RESTORE DATABASE BesMgmt
FROM DISK = 'D:\MSSQL\BACKUP\BesMgmt\BesMgmt_backup_device.bak '
WITH
--DBO_ONLY,
REPLACE,
--STANDBY = 'D:\MSSQL\Data\BesMgmt\undo_BesMgmt.ldf',
MOVE 'BesMgmt_data' TO 'D:\MSSQL\Data\BesMgmt.mdf',
MOVE 'BesMgmt_log' TO 'D:\MSSQL\Data\BesMgmt.ldf'

WAITFOR DELAY '00:00:05'

EXEC sp_dboption 'BesMgmt', 'single user', true
GO

I have set it to read only dbo only ... single user... still get the same message...
does anyone have any suggestions...try executing...

ALTER DATABASE <MyDB> SET RESTRICTED_USER WITH ROLLBACK IMMEDIATE

or

ALTER DATABASE <MyDB> SET SINGLE_USER WITH ROLLBACK IMMEDIATE

before the restore statement and drop the sp_dboption.|||thanks Thrasymachus
I'm still getting the same error:
Executed as user: NFCU\sqlsvc. RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013) Exclusive access could not be obtained because the database is in use. [SQLSTATE 42000] (Error 3101). The step failed.|||post the script you are currently using and try running sp_who when it fails to see what connections are in use. Also when you execute this script in the QA are you connected to the database you are trying to restore? The database selected from the dropdown should not be the database you are trying to restore. If everything is OK with your script I suspect this is the case.|||The error does not tally with this but just belt and braces.

If you run
EXEC sp_helpserver

do you see RPC & RPC out in the status field?|||When I set the database manually into single user mode I get a different error when trying to restore the database... this is the error that comes from when the database is in single user mode....
"Executed as user: NFCU\sqlsvc. Cannot open database requested in login 'BESMgmt'. Login fails. [SQLSTATE 42000] (Error 4060). The step failed."

CREATE PROCEDURE usp_restore_database_backups AS

/*
declare @.x varchar(255)
select @.x = @.x + ' kill ' + convert(varchar(5), spid)
from master.dbo.sysprocesses
where dbid = db_id ('BesMgmt')
exec (@.x)
*/

ALTER DATABASE BesMgmt SET SINGLE_USER WITH ROLLBACK IMMEDIATE

RESTORE DATABASE BesMgmt
FROM DISK = 'D:\MSSQL\BACKUP\BesMgmt\BesMgmt_backup_device.bak '
WITH
--DBO_ONLY,
REPLACE,
--STANDBY = 'D:\MSSQL\Data\BesMgmt\undo_BesMgmt.ldf',
MOVE 'BesMgmt_data' TO 'D:\MSSQL\Data\BesMgmt.mdf',
MOVE 'BesMgmt_log' TO 'D:\MSSQL\Data\BesMgmt.ldf'

WAITFOR DELAY '00:00:05'

--EXEC sp_dboption 'BesMgmt', 'single user', true
GO|||The command is within a job...
the sql agent service is ran under a domain user acount...

Tuesday, March 20, 2012

Remote server VS linked server

hi,
Could any one tell me what is the diff between remote server and linked
server?
I know linked server is for current sql server to access tables......
what about remote server>
thanks,"remote server" is another instance of sqlserver that the local sqlserver
connects to and queries data on behalf of the user. "linked server" is very
much the same thing, except it allows you to connect to any oledb data
source.
-oj
"mecn" <mecn2002@.yahoo.com> wrote in message
news:OyW3DV4TGHA.5500@.TK2MSFTNGP12.phx.gbl...
> hi,
> Could any one tell me what is the diff between remote server and linked
> server?
> I know linked server is for current sql server to access tables......
> what about remote server>
> thanks,
>|||oj wrote:
> "remote server" is another instance of sqlserver that the local sqlserver
> connects to and queries data on behalf of the user. "linked server" is ver
y
> much the same thing, except it allows you to connect to any oledb data
> source.
>
I'm not quite sure about that definition - A remote server could just
as well be on another server.
AFAIK Remote server is just in there for backward compatibility and you
should use linked server.
Regards
Steen|||indeed, remote server is there for backward (sql6x) compatibility.
"Configuring Remote Servers
A remote server configuration allows a client connected to one server
running Microsoft SQL ServerT to execute a stored procedure on another
server running SQL Server without establishing another connection. The
server to which the client is connected accepts the client request and sends
the request to the remote server on the client's behalf. The remote server
processes the request and returns any results to the original server, which
in turn passes those results to the client.
Remote server configurations have been superseded by linked server
configurations in SQL Server version 7.0. Both stored procedures and
distributed queries are allowed against linked servers; however, only stored
procedures are allowed against remote servers. Support for remote servers is
provided for backward compatibility only. If you are interested in setting
up a server configuration to execute stored procedures on another server,
and do not have existing remote server configurations, use linked servers
instead of remote servers.
Remote Server Details
Remote servers are set up in pairs. To set up a pair of remote servers,
configure both servers to recognize each other as remote servers. Then,
verify that configuration options are set properly for both servers, so that
each server running SQL Server allows remote users to execute procedure
calls. Check the configuration options in the Server Properties dialog box
on both the local and the remote servers.
In most cases, you should not need to set configuration options for remote
servers; the defaults set on both local and remote computers by SQL Server
Setup allow for remote server connections.
For remote server access to work, the remote access configuration option,
which controls logins from remote servers, must be set to 1 (the default
setting) on both the local and remote computers. If the setting for either
server's remote access option has been changed, you must reset the option
(for one or both servers) back to 1 to allow remote access. This can be
accomplished through either SQL Server Enterprise Manager or the
Transact-SQL sp_configure statement.
From the local server, you can disable a remote server configuration to
prevent user access to that server. "
-oj
"Steen Persson (DK)" <spe@.REMOVEdatea.dk> wrote in message
news:eShq9KkUGHA.6048@.TK2MSFTNGP11.phx.gbl...
> oj wrote:
> I'm not quite sure about that definition - A remote server could just as
> well be on another server.
> AFAIK Remote server is just in there for backward compatibility and you
> should use linked server.
> Regards
> Steen

Remote server VS linked server

hi,
Could any one tell me what is the diff between remote server and linked
server?
I know linked server is for current sql server to access tables......
what about remote server>
thanks,"remote server" is another instance of sqlserver that the local sqlserver
connects to and queries data on behalf of the user. "linked server" is very
much the same thing, except it allows you to connect to any oledb data
source.
-oj
"mecn" <mecn2002@.yahoo.com> wrote in message
news:OyW3DV4TGHA.5500@.TK2MSFTNGP12.phx.gbl...
> hi,
> Could any one tell me what is the diff between remote server and linked
> server?
> I know linked server is for current sql server to access tables......
> what about remote server>
> thanks,
>|||oj wrote:
> "remote server" is another instance of sqlserver that the local sqlserver
> connects to and queries data on behalf of the user. "linked server" is very
> much the same thing, except it allows you to connect to any oledb data
> source.
>
I'm not quite sure about that definition - A remote server could just
as well be on another server.
AFAIK Remote server is just in there for backward compatibility and you
should use linked server.
Regards
Steen|||indeed, remote server is there for backward (sql6x) compatibility.
"Configuring Remote Servers
A remote server configuration allows a client connected to one server
running Microsoft® SQL ServerT to execute a stored procedure on another
server running SQL Server without establishing another connection. The
server to which the client is connected accepts the client request and sends
the request to the remote server on the client's behalf. The remote server
processes the request and returns any results to the original server, which
in turn passes those results to the client.
Remote server configurations have been superseded by linked server
configurations in SQL Server version 7.0. Both stored procedures and
distributed queries are allowed against linked servers; however, only stored
procedures are allowed against remote servers. Support for remote servers is
provided for backward compatibility only. If you are interested in setting
up a server configuration to execute stored procedures on another server,
and do not have existing remote server configurations, use linked servers
instead of remote servers.
Remote Server Details
Remote servers are set up in pairs. To set up a pair of remote servers,
configure both servers to recognize each other as remote servers. Then,
verify that configuration options are set properly for both servers, so that
each server running SQL Server allows remote users to execute procedure
calls. Check the configuration options in the Server Properties dialog box
on both the local and the remote servers.
In most cases, you should not need to set configuration options for remote
servers; the defaults set on both local and remote computers by SQL Server
Setup allow for remote server connections.
For remote server access to work, the remote access configuration option,
which controls logins from remote servers, must be set to 1 (the default
setting) on both the local and remote computers. If the setting for either
server's remote access option has been changed, you must reset the option
(for one or both servers) back to 1 to allow remote access. This can be
accomplished through either SQL Server Enterprise Manager or the
Transact-SQL sp_configure statement.
From the local server, you can disable a remote server configuration to
prevent user access to that server. "
-oj
"Steen Persson (DK)" <spe@.REMOVEdatea.dk> wrote in message
news:eShq9KkUGHA.6048@.TK2MSFTNGP11.phx.gbl...
> oj wrote:
>> "remote server" is another instance of sqlserver that the local sqlserver
>> connects to and queries data on behalf of the user. "linked server" is
>> very much the same thing, except it allows you to connect to any oledb
>> data source.
>>
> I'm not quite sure about that definition - A remote server could just as
> well be on another server.
> AFAIK Remote server is just in there for backward compatibility and you
> should use linked server.
> Regards
> Steen

Remote server VS linked server

hi,
Could any one tell me what is the diff between remote server and linked
server?
I know linked server is for current sql server to access tables......
what about remote server>
thanks,
"remote server" is another instance of sqlserver that the local sqlserver
connects to and queries data on behalf of the user. "linked server" is very
much the same thing, except it allows you to connect to any oledb data
source.
-oj
"mecn" <mecn2002@.yahoo.com> wrote in message
news:OyW3DV4TGHA.5500@.TK2MSFTNGP12.phx.gbl...
> hi,
> Could any one tell me what is the diff between remote server and linked
> server?
> I know linked server is for current sql server to access tables......
> what about remote server>
> thanks,
>
|||oj wrote:
> "remote server" is another instance of sqlserver that the local sqlserver
> connects to and queries data on behalf of the user. "linked server" is very
> much the same thing, except it allows you to connect to any oledb data
> source.
>
I'm not quite sure about that definition - A remote server could just
as well be on another server.
AFAIK Remote server is just in there for backward compatibility and you
should use linked server.
Regards
Steen
|||indeed, remote server is there for backward (sql6x) compatibility.
"Configuring Remote Servers
A remote server configuration allows a client connected to one server
running Microsoft SQL ServerT to execute a stored procedure on another
server running SQL Server without establishing another connection. The
server to which the client is connected accepts the client request and sends
the request to the remote server on the client's behalf. The remote server
processes the request and returns any results to the original server, which
in turn passes those results to the client.
Remote server configurations have been superseded by linked server
configurations in SQL Server version 7.0. Both stored procedures and
distributed queries are allowed against linked servers; however, only stored
procedures are allowed against remote servers. Support for remote servers is
provided for backward compatibility only. If you are interested in setting
up a server configuration to execute stored procedures on another server,
and do not have existing remote server configurations, use linked servers
instead of remote servers.
Remote Server Details
Remote servers are set up in pairs. To set up a pair of remote servers,
configure both servers to recognize each other as remote servers. Then,
verify that configuration options are set properly for both servers, so that
each server running SQL Server allows remote users to execute procedure
calls. Check the configuration options in the Server Properties dialog box
on both the local and the remote servers.
In most cases, you should not need to set configuration options for remote
servers; the defaults set on both local and remote computers by SQL Server
Setup allow for remote server connections.
For remote server access to work, the remote access configuration option,
which controls logins from remote servers, must be set to 1 (the default
setting) on both the local and remote computers. If the setting for either
server's remote access option has been changed, you must reset the option
(for one or both servers) back to 1 to allow remote access. This can be
accomplished through either SQL Server Enterprise Manager or the
Transact-SQL sp_configure statement.
From the local server, you can disable a remote server configuration to
prevent user access to that server. "
-oj
"Steen Persson (DK)" <spe@.REMOVEdatea.dk> wrote in message
news:eShq9KkUGHA.6048@.TK2MSFTNGP11.phx.gbl...
> oj wrote:
> I'm not quite sure about that definition - A remote server could just as
> well be on another server.
> AFAIK Remote server is just in there for backward compatibility and you
> should use linked server.
> Regards
> Steen

Remote Server Vrs Linked Server

Hello,
I am a little confused on the difference. Say if I had two SQL Server
installations on a different Server, should a connect via a Linked or Remote
server link ?
If I had SQL Server and Excel, linked or remote ?
Could someone please point me to a resource to tell me the difference ?
thanks
P
Patricia,
Remote servers are provided for backwards compatibility and should not be
used. Linked servers provide more options for configuring secure access, and
will work against any OLE-DB source including Oracle, Access, Spreadsheets
etc .
You can find information on linked servers in Books Online.
Some additional information for SQL - SQL connections ;
Explicit mappings should be defined for the accounts that require access to
the remote server. For logins not explicitly mapped, connections should not
be allowed.
When creating an explicit mapping between a local user and a remote user,
the Impersonate mode should be used to pass through the identity of the
source user to the linked server. In order for this to work, both the
account and the SQL Server need to be trusted for delegation, and both the
source and destination servers need to be running Windows 2000 or later with
Kerberos security enabled.
If these delegation conditions are not met, then an explicit username and
password can be used which needs to be setup as a SQL Server login on the
remote server. Network transmission should be secured with SSL between the 2
servers, and strong passwords in place.
For Non SQL Server data sources, the DisallowAdHocAccess option should be
used with care, and only on trusted sources.
Regards,
Rod Colledge.
"Patricia" <Patricia@.discussions.microsoft.com> wrote in message
news:00F9121D-3C0C-477A-A8BA-8687507E789B@.microsoft.com...
> Hello,
> I am a little confused on the difference. Say if I had two SQL Server
> installations on a different Server, should a connect via a Linked or
> Remote
> server link ?
> If I had SQL Server and Excel, linked or remote ?
> Could someone please point me to a resource to tell me the difference ?
> thanks
> P
|||Thanks Rod
"Rod Colledge" wrote:

> Patricia,
> Remote servers are provided for backwards compatibility and should not be
> used. Linked servers provide more options for configuring secure access, and
> will work against any OLE-DB source including Oracle, Access, Spreadsheets
> etc .
> You can find information on linked servers in Books Online.
> Some additional information for SQL - SQL connections ;
> Explicit mappings should be defined for the accounts that require access to
> the remote server. For logins not explicitly mapped, connections should not
> be allowed.
>
> When creating an explicit mapping between a local user and a remote user,
> the Impersonate mode should be used to pass through the identity of the
> source user to the linked server. In order for this to work, both the
> account and the SQL Server need to be trusted for delegation, and both the
> source and destination servers need to be running Windows 2000 or later with
> Kerberos security enabled.
>
> If these delegation conditions are not met, then an explicit username and
> password can be used which needs to be setup as a SQL Server login on the
> remote server. Network transmission should be secured with SSL between the 2
> servers, and strong passwords in place.
>
> For Non SQL Server data sources, the DisallowAdHocAccess option should be
> used with care, and only on trusted sources.
>
> Regards,
> Rod Colledge.
>
> "Patricia" <Patricia@.discussions.microsoft.com> wrote in message
> news:00F9121D-3C0C-477A-A8BA-8687507E789B@.microsoft.com...
>
>

Remote Server Vrs Linked Server

Hello,
I am a little confused on the difference. Say if I had two SQL Server
installations on a different Server, should a connect via a Linked or Remote
server link ?
If I had SQL Server and Excel, linked or remote ?
Could someone please point me to a resource to tell me the difference ?
thanks
PPatricia,
Remote servers are provided for backwards compatibility and should not be
used. Linked servers provide more options for configuring secure access, and
will work against any OLE-DB source including Oracle, Access, Spreadsheets
etc .
You can find information on linked servers in Books Online.
Some additional information for SQL - SQL connections ;
Explicit mappings should be defined for the accounts that require access to
the remote server. For logins not explicitly mapped, connections should not
be allowed.
When creating an explicit mapping between a local user and a remote user,
the Impersonate mode should be used to pass through the identity of the
source user to the linked server. In order for this to work, both the
account and the SQL Server need to be trusted for delegation, and both the
source and destination servers need to be running Windows 2000 or later with
Kerberos security enabled.
If these delegation conditions are not met, then an explicit username and
password can be used which needs to be setup as a SQL Server login on the
remote server. Network transmission should be secured with SSL between the 2
servers, and strong passwords in place.
For Non SQL Server data sources, the DisallowAdHocAccess option should be
used with care, and only on trusted sources.
Regards,
Rod Colledge.
"Patricia" <Patricia@.discussions.microsoft.com> wrote in message
news:00F9121D-3C0C-477A-A8BA-8687507E789B@.microsoft.com...
> Hello,
> I am a little confused on the difference. Say if I had two SQL Server
> installations on a different Server, should a connect via a Linked or
> Remote
> server link ?
> If I had SQL Server and Excel, linked or remote ?
> Could someone please point me to a resource to tell me the difference ?
> thanks
> P|||Thanks Rod
"Rod Colledge" wrote:
> Patricia,
> Remote servers are provided for backwards compatibility and should not be
> used. Linked servers provide more options for configuring secure access, and
> will work against any OLE-DB source including Oracle, Access, Spreadsheets
> etc .
> You can find information on linked servers in Books Online.
> Some additional information for SQL - SQL connections ;
> Explicit mappings should be defined for the accounts that require access to
> the remote server. For logins not explicitly mapped, connections should not
> be allowed.
>
> When creating an explicit mapping between a local user and a remote user,
> the Impersonate mode should be used to pass through the identity of the
> source user to the linked server. In order for this to work, both the
> account and the SQL Server need to be trusted for delegation, and both the
> source and destination servers need to be running Windows 2000 or later with
> Kerberos security enabled.
>
> If these delegation conditions are not met, then an explicit username and
> password can be used which needs to be setup as a SQL Server login on the
> remote server. Network transmission should be secured with SSL between the 2
> servers, and strong passwords in place.
>
> For Non SQL Server data sources, the DisallowAdHocAccess option should be
> used with care, and only on trusted sources.
>
> Regards,
> Rod Colledge.
>
> "Patricia" <Patricia@.discussions.microsoft.com> wrote in message
> news:00F9121D-3C0C-477A-A8BA-8687507E789B@.microsoft.com...
> > Hello,
> >
> > I am a little confused on the difference. Say if I had two SQL Server
> > installations on a different Server, should a connect via a Linked or
> > Remote
> > server link ?
> >
> > If I had SQL Server and Excel, linked or remote ?
> >
> > Could someone please point me to a resource to tell me the difference ?
> >
> > thanks
> > P
>
>

Remote Server Vrs Linked Server

Hello,
I am a little confused on the difference. Say if I had two SQL Server
installations on a different Server, should a connect via a Linked or Remote
server link ?
If I had SQL Server and Excel, linked or remote ?
Could someone please point me to a resource to tell me the difference ?
thanks
PPatricia,
Remote servers are provided for backwards compatibility and should not be
used. Linked servers provide more options for configuring secure access, and
will work against any OLE-DB source including Oracle, Access, Spreadsheets
etc .
You can find information on linked servers in Books Online.
Some additional information for SQL - SQL connections ;
Explicit mappings should be defined for the accounts that require access to
the remote server. For logins not explicitly mapped, connections should not
be allowed.
When creating an explicit mapping between a local user and a remote user,
the Impersonate mode should be used to pass through the identity of the
source user to the linked server. In order for this to work, both the
account and the SQL Server need to be trusted for delegation, and both the
source and destination servers need to be running Windows 2000 or later with
Kerberos security enabled.
If these delegation conditions are not met, then an explicit username and
password can be used which needs to be setup as a SQL Server login on the
remote server. Network transmission should be secured with SSL between the 2
servers, and strong passwords in place.
For Non SQL Server data sources, the DisallowAdHocAccess option should be
used with care, and only on trusted sources.
Regards,
Rod Colledge.
"Patricia" <Patricia@.discussions.microsoft.com> wrote in message
news:00F9121D-3C0C-477A-A8BA-8687507E789B@.microsoft.com...
> Hello,
> I am a little confused on the difference. Say if I had two SQL Server
> installations on a different Server, should a connect via a Linked or
> Remote
> server link ?
> If I had SQL Server and Excel, linked or remote ?
> Could someone please point me to a resource to tell me the difference ?
> thanks
> P|||Thanks Rod
"Rod Colledge" wrote:

> Patricia,
> Remote servers are provided for backwards compatibility and should not be
> used. Linked servers provide more options for configuring secure access, a
nd
> will work against any OLE-DB source including Oracle, Access, Spreadsheets
> etc .
> You can find information on linked servers in Books Online.
> Some additional information for SQL - SQL connections ;
> Explicit mappings should be defined for the accounts that require access t
o
> the remote server. For logins not explicitly mapped, connections should no
t
> be allowed.
>
> When creating an explicit mapping between a local user and a remote user,
> the Impersonate mode should be used to pass through the identity of the
> source user to the linked server. In order for this to work, both the
> account and the SQL Server need to be trusted for delegation, and both the
> source and destination servers need to be running Windows 2000 or later wi
th
> Kerberos security enabled.
>
> If these delegation conditions are not met, then an explicit username and
> password can be used which needs to be setup as a SQL Server login on the
> remote server. Network transmission should be secured with SSL between the
2
> servers, and strong passwords in place.
>
> For Non SQL Server data sources, the DisallowAdHocAccess option should be
> used with care, and only on trusted sources.
>
> Regards,
> Rod Colledge.
>
> "Patricia" <Patricia@.discussions.microsoft.com> wrote in message
> news:00F9121D-3C0C-477A-A8BA-8687507E789B@.microsoft.com...
>
>

Remote Server question

sql2k sp3
Ive always used Linked Servers and as such dont really know about Remote
Servers. Anyways, here is the deal.
Box1 -- Replication Publisher. Has a Remote Server defined for Box2, which
is a Subscriber to Box1.
So, Im trying to exec a proc on Box2 while logged on to Box1 while logged in
as SA. But I get the message:
Server: Msg 18483, Level 14, State 1, Line 1
Could not connect to server 'BLA'because 'sa' is not defined as a remote
login at the server.
The SA password is the same on both these boxes, so while logged in as SA I:
sp_addlinkedsrvlogin @.rmtsrvname = 'cpdbovs01'
, @.useself = 'true'
but that doesnt make my problem go away. The really funny thing here is that
I googled it, saw that I posted the same question years ago, see that I got
it, but cant read the answer.
TIA, ChrisRThis is a multi-part message in MIME format.
--090909090705070004050507
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Is it possible that your remote server is set up to use Windows
Authentication only? (Even though you can set the 'sa' password, that
doesn't imply you can actually login using that standard SQL login.)
--
*mike hodgson*
blog: http://sqlnerd.blogspot.com
ChrisR wrote:
>sql2k sp3
>
>Ive always used Linked Servers and as such dont really know about Remote
>Servers. Anyways, here is the deal.
>Box1 -- Replication Publisher. Has a Remote Server defined for Box2, which
>is a Subscriber to Box1.
>So, Im trying to exec a proc on Box2 while logged on to Box1 while logged in
>as SA. But I get the message:
>Server: Msg 18483, Level 14, State 1, Line 1
>Could not connect to server 'BLA'because 'sa' is not defined as a remote
>login at the server.
>The SA password is the same on both these boxes, so while logged in as SA I:
>
>sp_addlinkedsrvlogin @.rmtsrvname = 'cpdbovs01'
> , @.useself = 'true'
>but that doesnt make my problem go away. The really funny thing here is that
>I googled it, saw that I posted the same question years ago, see that I got
>it, but cant read the answer.
>TIA, ChrisR
>
>
>
--090909090705070004050507
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Is it possible that your remote server is set up to use Windows
Authentication only? (Even though you can set the 'sa' password, that
doesn't imply you can actually login using that standard SQL login.)</tt><br>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font></span> <b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"><br>
<font face="Tahoma" size="2">blog:</font><font face="Tahoma" size="2"> <a
href="http://links.10026.com/?link=http://sqlnerd.blogspot.com</a></font></span>">http://sqlnerd.blogspot.com">http://sqlnerd.blogspot.com</a></font></span>
</p>
</div>
<br>
<br>
ChrisR wrote:
<blockquote cite="mid%230BGYuarFHA.3424@.TK2MSFTNGP14.phx.gbl"
type="cite">
<pre wrap="">sql2k sp3
Ive always used Linked Servers and as such dont really know about Remote
Servers. Anyways, here is the deal.
Box1 -- Replication Publisher. Has a Remote Server defined for Box2, which
is a Subscriber to Box1.
So, Im trying to exec a proc on Box2 while logged on to Box1 while logged in
as SA. But I get the message:
Server: Msg 18483, Level 14, State 1, Line 1
Could not connect to server 'BLA'because 'sa' is not defined as a remote
login at the server.
The SA password is the same on both these boxes, so while logged in as SA I:
sp_addlinkedsrvlogin @.rmtsrvname = 'cpdbovs01'
, @.useself = 'true'
but that doesnt make my problem go away. The really funny thing here is that
I googled it, saw that I posted the same question years ago, see that I got
it, but cant read the answer.
TIA, ChrisR
</pre>
</blockquote>
</body>
</html>
--090909090705070004050507--|||This is a multi-part message in MIME format.
--=_NextPart_000_0008_01C5AE09.DF950070
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thanks Mike, but no thats not the case.
"Mike Hodgson" <mike.hodgson@.mallesons.nospam.com> wrote in message =news:O$vQwAdrFHA.908@.tk2msftngp13.phx.gbl...
Is it possible that your remote server is set up to use Windows =Authentication only? (Even though you can set the 'sa' password, that =doesn't imply you can actually login using that standard SQL login.)
--
mike hodgson
blog: http://sqlnerd.blogspot.com=20
ChrisR wrote: sql2k sp3
Ive always used Linked Servers and as such dont really know about Remote =
Servers. Anyways, here is the deal.
Box1 -- Replication Publisher. Has a Remote Server defined for Box2, =which is a Subscriber to Box1.
So, Im trying to exec a proc on Box2 while logged on to Box1 while =logged in as SA. But I get the message:
Server: Msg 18483, Level 14, State 1, Line 1
Could not connect to server 'BLA'because 'sa' is not defined as a remote =
login at the server.
The SA password is the same on both these boxes, so while logged in as =SA I:
sp_addlinkedsrvlogin @.rmtsrvname =3D 'cpdbovs01'
, @.useself =3D 'true'
but that doesnt make my problem go away. The really funny thing here is =that I googled it, saw that I posted the same question years ago, see that I =got it, but cant read the answer.
TIA, ChrisR
--=_NextPart_000_0008_01C5AE09.DF950070
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

Thanks Mike, but no thats not the case.
"Mike Hodgson" wrote in message news:O$vQwAdrFHA.908@.t=k2msftngp13.phx.gbl...Is it possible that your remote server is set up to use Windows =Authentication only? (Even though you can set the 'sa' password, that doesn't =imply you can actually login using that standard SQL login.)
--mike =hodgsonblog: http://sqlnerd.blogspot.com ChrisR wrote: sql2k sp3
Ive always used Linked Servers and as such dont really know about Remote =Servers. Anyways, here is the deal.
Box1 -- Replication Publisher. Has a Remote Server defined for Box2, =which is a Subscriber to Box1.
So, Im trying to exec a proc on Box2 while logged on to Box1 while =logged in as SA. But I get the message:
Server: Msg 18483, Level 14, State 1, Line 1
Could not connect to server 'BLA'because 'sa' is not defined as a remote =login at the server.
The SA password is the same on both these boxes, so while logged in as =SA I:
sp_addlinkedsrvlogin @.rmtsrvname =3D 'cpdbovs01'
, @.useself =3D 'true'
but that doesnt make my problem go away. The really funny thing here is =that I googled it, saw that I posted the same question years ago, see that I =got it, but cant read the answer.
TIA, ChrisR


--=_NextPart_000_0008_01C5AE09.DF950070--

Remote Server question

sql2k sp3
Ive always used Linked Servers and as such dont really know about Remote
Servers. Anyways, here is the deal.
Box1 -- Replication Publisher. Has a Remote Server defined for Box2, which
is a Subscriber to Box1.
So, Im trying to exec a proc on Box2 while logged on to Box1 while logged in
as SA. But I get the message:
Server: Msg 18483, Level 14, State 1, Line 1
Could not connect to server 'BLA'because 'sa' is not defined as a remote
login at the server.
The SA password is the same on both these boxes, so while logged in as SA I:
sp_addlinkedsrvlogin @.rmtsrvname = 'cpdbovs01'
, @.useself = 'true'
but that doesnt make my problem go away. The really funny thing here is that
I googled it, saw that I posted the same question years ago, see that I got
it, but cant read the answer.
TIA, ChrisRIs it possible that your remote server is set up to use Windows
Authentication only? (Even though you can set the 'sa' password, that
doesn't imply you can actually login using that standard SQL login.)
*mike hodgson*
blog: http://sqlnerd.blogspot.com
ChrisR wrote:

>sql2k sp3
>
>Ive always used Linked Servers and as such dont really know about Remote
>Servers. Anyways, here is the deal.
>Box1 -- Replication Publisher. Has a Remote Server defined for Box2, which
>is a Subscriber to Box1.
>So, Im trying to exec a proc on Box2 while logged on to Box1 while logged i
n
>as SA. But I get the message:
>Server: Msg 18483, Level 14, State 1, Line 1
>Could not connect to server 'BLA'because 'sa' is not defined as a remote
>login at the server.
>The SA password is the same on both these boxes, so while logged in as SA I
:
>
>sp_addlinkedsrvlogin @.rmtsrvname = 'cpdbovs01'
> , @.useself = 'true'
>but that doesnt make my problem go away. The really funny thing here is tha
t
>I googled it, saw that I posted the same question years ago, see that I got
>it, but cant read the answer.
>TIA, ChrisR
>
>
>|||Thanks Mike, but no thats not the case.
"Mike Hodgson" <mike.hodgson@.mallesons.nospam.com> wrote in message news:O$v
QwAdrFHA.908@.tk2msftngp13.phx.gbl...
Is it possible that your remote server is set up to use Windows Authenticati
on only? (Even though you can set the 'sa' password, that doesn't imply you
can actually login using that standard SQL login.)
mike hodgson
blog: http://sqlnerd.blogspot.com
ChrisR wrote:
sql2k sp3
Ive always used Linked Servers and as such dont really know about Remote
Servers. Anyways, here is the deal.
Box1 -- Replication Publisher. Has a Remote Server defined for Box2, which
is a Subscriber to Box1.
So, Im trying to exec a proc on Box2 while logged on to Box1 while logged in
as SA. But I get the message:
Server: Msg 18483, Level 14, State 1, Line 1
Could not connect to server 'BLA'because 'sa' is not defined as a remote
login at the server.
The SA password is the same on both these boxes, so while logged in as SA I:
sp_addlinkedsrvlogin @.rmtsrvname = 'cpdbovs01'
, @.useself = 'true'
but that doesnt make my problem go away. The really funny thing here is that
I googled it, saw that I posted the same question years ago, see that I got
it, but cant read the answer.
TIA, ChrisR

Remote Server question

sql2k sp3
Ive always used Linked Servers and as such dont really know about Remote
Servers. Anyways, here is the deal.
Box1 -- Replication Publisher. Has a Remote Server defined for Box2, which
is a Subscriber to Box1.
So, Im trying to exec a proc on Box2 while logged on to Box1 while logged in
as SA. But I get the message:
Server: Msg 18483, Level 14, State 1, Line 1
Could not connect to server 'BLA'because 'sa' is not defined as a remote
login at the server.
The SA password is the same on both these boxes, so while logged in as SA I:
sp_addlinkedsrvlogin @.rmtsrvname = 'cpdbovs01'
, @.useself = 'true'
but that doesnt make my problem go away. The really funny thing here is that
I googled it, saw that I posted the same question years ago, see that I got
it, but cant read the answer.
TIA, ChrisR
Is it possible that your remote server is set up to use Windows
Authentication only? (Even though you can set the 'sa' password, that
doesn't imply you can actually login using that standard SQL login.)
*mike hodgson*
blog: http://sqlnerd.blogspot.com
ChrisR wrote:

>sql2k sp3
>
>Ive always used Linked Servers and as such dont really know about Remote
>Servers. Anyways, here is the deal.
>Box1 -- Replication Publisher. Has a Remote Server defined for Box2, which
>is a Subscriber to Box1.
>So, Im trying to exec a proc on Box2 while logged on to Box1 while logged in
>as SA. But I get the message:
>Server: Msg 18483, Level 14, State 1, Line 1
>Could not connect to server 'BLA'because 'sa' is not defined as a remote
>login at the server.
>The SA password is the same on both these boxes, so while logged in as SA I:
>
>sp_addlinkedsrvlogin @.rmtsrvname = 'cpdbovs01'
> , @.useself = 'true'
>but that doesnt make my problem go away. The really funny thing here is that
>I googled it, saw that I posted the same question years ago, see that I got
>it, but cant read the answer.
>TIA, ChrisR
>
>
>
|||Thanks Mike, but no thats not the case.
"Mike Hodgson" <mike.hodgson@.mallesons.nospam.com> wrote in message news:O$vQwAdrFHA.908@.tk2msftngp13.phx.gbl...
Is it possible that your remote server is set up to use Windows Authentication only? (Even though you can set the 'sa' password, that doesn't imply you can actually login using that standard SQL login.)
mike hodgson
blog: http://sqlnerd.blogspot.com
ChrisR wrote:
sql2k sp3
Ive always used Linked Servers and as such dont really know about Remote
Servers. Anyways, here is the deal.
Box1 -- Replication Publisher. Has a Remote Server defined for Box2, which
is a Subscriber to Box1.
So, Im trying to exec a proc on Box2 while logged on to Box1 while logged in
as SA. But I get the message:
Server: Msg 18483, Level 14, State 1, Line 1
Could not connect to server 'BLA'because 'sa' is not defined as a remote
login at the server.
The SA password is the same on both these boxes, so while logged in as SA I:
sp_addlinkedsrvlogin @.rmtsrvname = 'cpdbovs01'
, @.useself = 'true'
but that doesnt make my problem go away. The really funny thing here is that
I googled it, saw that I posted the same question years ago, see that I got
it, but cant read the answer.
TIA, ChrisR

Remote Server / Linked Server

I have transactional replication working and it created a remote server
to be used for replication. I am not able to insert/delete/update
between the two servers through the "remote server" connection. I need
to use a linked server, do I need to set up this linked server prior to
configuring any replication so a remote server isn't created during
configuration? Is there something else I can do instead of this.
Thanks
sp_serveroption 'remoteServerName','data access',true
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"billy_karnes" <billy_karnes@.corphealth.com> wrote in message
news:1142538888.208897.59030@.e56g2000cwe.googlegro ups.com...
>I have transactional replication working and it created a remote server
> to be used for replication. I am not able to insert/delete/update
> between the two servers through the "remote server" connection. I need
> to use a linked server, do I need to set up this linked server prior to
> configuring any replication so a remote server isn't created during
> configuration? Is there something else I can do instead of this.
> Thanks
>
|||I changed the data access to true, but now I get the following error
Msg 18452, Level 14, State 1, Line 1
Login failed for user '(null)'. Reason: Not associated with a trusted
SQL Server connection.
The security properties are set to: "Be made using the login's current
security context"
I have sysadmin priviledges so I shouldn't be restricted by that. I
can get it to work and pull data, if I change the security properties
to use the sa login and password, but that isn't secure enough. What
options do I have. Thanks for your time.
|||Enter the sa account and password on the linked server.
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"billy_karnes" <billy_karnes@.corphealth.com> wrote in message
news:1142872805.003828.93830@.t31g2000cwb.googlegro ups.com...
>I changed the data access to true, but now I get the following error
> Msg 18452, Level 14, State 1, Line 1
> Login failed for user '(null)'. Reason: Not associated with a trusted
> SQL Server connection.
> The security properties are set to: "Be made using the login's current
> security context"
> I have sysadmin priviledges so I shouldn't be restricted by that. I
> can get it to work and pull data, if I change the security properties
> to use the sa login and password, but that isn't secure enough. What
> options do I have. Thanks for your time.
>
|||Maybe I didn't state my question correctly. I am wanting to use the
security property of: "Be made using the login's current
security context" so it can limit the users priviledges to the other
server. When I do this I get the following error.
Msg 18452, Level 14, State 1, Line 1
Login failed for user '(null)'. Reason: Not associated with a trusted
SQL Server connection
I was able to use the sa login and password, but that allowed everyone
to have unlimited access to the linked server.
How do I get the security property of: "Be made using the login's
current security context" to work without getting the error. Thanks
|||I don't believe you can as you are logging on using Windows Authentication,
and it appears that the remote server is not part of the domain. Perhaps try
pass through authentication. By any chance is the remote server across the
internet?
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.
This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"billy_karnes" <billy_karnes@.corphealth.com> wrote in message
news:1142879939.773655.304440@.z34g2000cwc.googlegr oups.com...
> Maybe I didn't state my question correctly. I am wanting to use the
> security property of: "Be made using the login's current
> security context" so it can limit the users priviledges to the other
> server. When I do this I get the following error.
> Msg 18452, Level 14, State 1, Line 1
> Login failed for user '(null)'. Reason: Not associated with a trusted
> SQL Server connection
>
> I was able to use the sa login and password, but that allowed everyone
> to have unlimited access to the linked server.
>
> How do I get the security property of: "Be made using the login's
> current security context" to work without getting the error. Thanks
>

Monday, March 12, 2012

Remote scan on linked server

I've got an interesting situation. I have two SQL 2000 servers and a proc o
n
one that updates data on the other. If I use literal values in the where
clause of the update statement then the query plan uses a "remote query" to
do the update. If I use variables then it uses a "remote scan" and filters
locally. Obviously that takes too long.
Here is some sample script.
-- This uses a remote query
UPDATE [Server2].Orders.dbo.OrderHistory
SET Salesperson = 'ROB'
WHERE OrderNumber = 12345
-- This uses a remote scan
DECLARE @.Salesperson CHAR(3)
DECLARE @.OrderNumber INT
SELECT @.Salesperson = 'ROB', @.OrderNumber = 12345
UPDATE [Server2].Orders.dbo.OrderHistory
SET Salesperson = @.Salesperson
WHERE OrderNumber = @.OrderNumber
-- This uses a remote query; same table and index structure; linked server
defined the same
UPDATE [Server3].Orders.dbo.OrderHistory
SET Salesperson = @.Salesperson
WHERE OrderNumber = @.OrderNumber
I can't figure out any reason why it does it that way. To make things more
odd, that proc updates a couple other servers in the same way for the same
table and those use remote queries. The linked servers are defined the same
,
the table structure and indexes are the same.
Does anyone have any idea why it would work this way?
Thanks.
Dale.Is it possible the datatypes of those declared variables are not equal to
the corresponding data types on the linked server? In any case you should
try using OPENQUERY() as it will pass thru all queries so they are always
interpreted on the other side just as you wrote them with no odbc
intervention.
Andrew J. Kelly SQL MVP
"Dale M." <DaleM@.discussions.microsoft.com> wrote in message
news:5EAABBC0-BFF8-4DC6-BF0C-911DBAAB5B5C@.microsoft.com...
> I've got an interesting situation. I have two SQL 2000 servers and a proc
> on
> one that updates data on the other. If I use literal values in the where
> clause of the update statement then the query plan uses a "remote query"
> to
> do the update. If I use variables then it uses a "remote scan" and
> filters
> locally. Obviously that takes too long.
> Here is some sample script.
> -- This uses a remote query
> UPDATE [Server2].Orders.dbo.OrderHistory
> SET Salesperson = 'ROB'
> WHERE OrderNumber = 12345
> -- This uses a remote scan
> DECLARE @.Salesperson CHAR(3)
> DECLARE @.OrderNumber INT
> SELECT @.Salesperson = 'ROB', @.OrderNumber = 12345
> UPDATE [Server2].Orders.dbo.OrderHistory
> SET Salesperson = @.Salesperson
> WHERE OrderNumber = @.OrderNumber
> -- This uses a remote query; same table and index structure; linked server
> defined the same
> UPDATE [Server3].Orders.dbo.OrderHistory
> SET Salesperson = @.Salesperson
> WHERE OrderNumber = @.OrderNumber
> I can't figure out any reason why it does it that way. To make things
> more
> odd, that proc updates a couple other servers in the same way for the same
> table and those use remote queries. The linked servers are defined the
> same,
> the table structure and indexes are the same.
> Does anyone have any idea why it would work this way?
> Thanks.
> Dale.
>|||Thanks for the reply.
The data types are the same.
I've tried several variations of OPENQUERY syntax but it doesn't like
variables in its parameters, so I'm not sure how to get the update done.
Plus, I'd sorta like to know why anyways.
"Andrew J. Kelly" wrote:

> Is it possible the datatypes of those declared variables are not equal to
> the corresponding data types on the linked server? In any case you should
> try using OPENQUERY() as it will pass thru all queries so they are always
> interpreted on the other side just as you wrote them with no odbc
> intervention.
> --
> Andrew J. Kelly SQL MVP
> "Dale M." <DaleM@.discussions.microsoft.com> wrote in message
> news:5EAABBC0-BFF8-4DC6-BF0C-911DBAAB5B5C@.microsoft.com...
>
>

Remote scan on linked server

I've got an interesting situation. I have two SQL 2000 servers and a proc on
one that updates data on the other. If I use literal values in the where
clause of the update statement then the query plan uses a "remote query" to
do the update. If I use variables then it uses a "remote scan" and filters
locally. Obviously that takes too long.
Here is some sample script.
-- This uses a remote query
UPDATE [Server2].Orders.dbo.OrderHistory
SET Salesperson = 'ROB'
WHERE OrderNumber = 12345
-- This uses a remote scan
DECLARE @.Salesperson CHAR(3)
DECLARE @.OrderNumber INT
SELECT @.Salesperson = 'ROB', @.OrderNumber = 12345
UPDATE [Server2].Orders.dbo.OrderHistory
SET Salesperson = @.Salesperson
WHERE OrderNumber = @.OrderNumber
-- This uses a remote query; same table and index structure; linked server
defined the same
UPDATE [Server3].Orders.dbo.OrderHistory
SET Salesperson = @.Salesperson
WHERE OrderNumber = @.OrderNumber
I can't figure out any reason why it does it that way. To make things more
odd, that proc updates a couple other servers in the same way for the same
table and those use remote queries. The linked servers are defined the same,
the table structure and indexes are the same.
Does anyone have any idea why it would work this way?
Thanks.
Dale.Is it possible the datatypes of those declared variables are not equal to
the corresponding data types on the linked server? In any case you should
try using OPENQUERY() as it will pass thru all queries so they are always
interpreted on the other side just as you wrote them with no odbc
intervention.
--
Andrew J. Kelly SQL MVP
"Dale M." <DaleM@.discussions.microsoft.com> wrote in message
news:5EAABBC0-BFF8-4DC6-BF0C-911DBAAB5B5C@.microsoft.com...
> I've got an interesting situation. I have two SQL 2000 servers and a proc
> on
> one that updates data on the other. If I use literal values in the where
> clause of the update statement then the query plan uses a "remote query"
> to
> do the update. If I use variables then it uses a "remote scan" and
> filters
> locally. Obviously that takes too long.
> Here is some sample script.
> -- This uses a remote query
> UPDATE [Server2].Orders.dbo.OrderHistory
> SET Salesperson = 'ROB'
> WHERE OrderNumber = 12345
> -- This uses a remote scan
> DECLARE @.Salesperson CHAR(3)
> DECLARE @.OrderNumber INT
> SELECT @.Salesperson = 'ROB', @.OrderNumber = 12345
> UPDATE [Server2].Orders.dbo.OrderHistory
> SET Salesperson = @.Salesperson
> WHERE OrderNumber = @.OrderNumber
> -- This uses a remote query; same table and index structure; linked server
> defined the same
> UPDATE [Server3].Orders.dbo.OrderHistory
> SET Salesperson = @.Salesperson
> WHERE OrderNumber = @.OrderNumber
> I can't figure out any reason why it does it that way. To make things
> more
> odd, that proc updates a couple other servers in the same way for the same
> table and those use remote queries. The linked servers are defined the
> same,
> the table structure and indexes are the same.
> Does anyone have any idea why it would work this way?
> Thanks.
> Dale.
>|||Thanks for the reply.
The data types are the same.
I've tried several variations of OPENQUERY syntax but it doesn't like
variables in its parameters, so I'm not sure how to get the update done.
Plus, I'd sorta like to know why anyways.
"Andrew J. Kelly" wrote:
> Is it possible the datatypes of those declared variables are not equal to
> the corresponding data types on the linked server? In any case you should
> try using OPENQUERY() as it will pass thru all queries so they are always
> interpreted on the other side just as you wrote them with no odbc
> intervention.
> --
> Andrew J. Kelly SQL MVP
> "Dale M." <DaleM@.discussions.microsoft.com> wrote in message
> news:5EAABBC0-BFF8-4DC6-BF0C-911DBAAB5B5C@.microsoft.com...
> > I've got an interesting situation. I have two SQL 2000 servers and a proc
> > on
> > one that updates data on the other. If I use literal values in the where
> > clause of the update statement then the query plan uses a "remote query"
> > to
> > do the update. If I use variables then it uses a "remote scan" and
> > filters
> > locally. Obviously that takes too long.
> >
> > Here is some sample script.
> > -- This uses a remote query
> > UPDATE [Server2].Orders.dbo.OrderHistory
> > SET Salesperson = 'ROB'
> > WHERE OrderNumber = 12345
> >
> > -- This uses a remote scan
> > DECLARE @.Salesperson CHAR(3)
> > DECLARE @.OrderNumber INT
> > SELECT @.Salesperson = 'ROB', @.OrderNumber = 12345
> >
> > UPDATE [Server2].Orders.dbo.OrderHistory
> > SET Salesperson = @.Salesperson
> > WHERE OrderNumber = @.OrderNumber
> >
> > -- This uses a remote query; same table and index structure; linked server
> > defined the same
> > UPDATE [Server3].Orders.dbo.OrderHistory
> > SET Salesperson = @.Salesperson
> > WHERE OrderNumber = @.OrderNumber
> >
> > I can't figure out any reason why it does it that way. To make things
> > more
> > odd, that proc updates a couple other servers in the same way for the same
> > table and those use remote queries. The linked servers are defined the
> > same,
> > the table structure and indexes are the same.
> >
> > Does anyone have any idea why it would work this way?
> >
> > Thanks.
> >
> > Dale.
> >
>
>

Remote scan on linked server

I've got an interesting situation. I have two SQL 2000 servers and a proc on
one that updates data on the other. If I use literal values in the where
clause of the update statement then the query plan uses a "remote query" to
do the update. If I use variables then it uses a "remote scan" and filters
locally. Obviously that takes too long.
Here is some sample script.
-- This uses a remote query
UPDATE [Server2].Orders.dbo.OrderHistory
SET Salesperson = 'ROB'
WHERE OrderNumber = 12345
-- This uses a remote scan
DECLARE @.Salesperson CHAR(3)
DECLARE @.OrderNumber INT
SELECT @.Salesperson = 'ROB', @.OrderNumber = 12345
UPDATE [Server2].Orders.dbo.OrderHistory
SET Salesperson = @.Salesperson
WHERE OrderNumber = @.OrderNumber
-- This uses a remote query; same table and index structure; linked server
defined the same
UPDATE [Server3].Orders.dbo.OrderHistory
SET Salesperson = @.Salesperson
WHERE OrderNumber = @.OrderNumber
I can't figure out any reason why it does it that way. To make things more
odd, that proc updates a couple other servers in the same way for the same
table and those use remote queries. The linked servers are defined the same,
the table structure and indexes are the same.
Does anyone have any idea why it would work this way?
Thanks.
Dale.
Is it possible the datatypes of those declared variables are not equal to
the corresponding data types on the linked server? In any case you should
try using OPENQUERY() as it will pass thru all queries so they are always
interpreted on the other side just as you wrote them with no odbc
intervention.
Andrew J. Kelly SQL MVP
"Dale M." <DaleM@.discussions.microsoft.com> wrote in message
news:5EAABBC0-BFF8-4DC6-BF0C-911DBAAB5B5C@.microsoft.com...
> I've got an interesting situation. I have two SQL 2000 servers and a proc
> on
> one that updates data on the other. If I use literal values in the where
> clause of the update statement then the query plan uses a "remote query"
> to
> do the update. If I use variables then it uses a "remote scan" and
> filters
> locally. Obviously that takes too long.
> Here is some sample script.
> -- This uses a remote query
> UPDATE [Server2].Orders.dbo.OrderHistory
> SET Salesperson = 'ROB'
> WHERE OrderNumber = 12345
> -- This uses a remote scan
> DECLARE @.Salesperson CHAR(3)
> DECLARE @.OrderNumber INT
> SELECT @.Salesperson = 'ROB', @.OrderNumber = 12345
> UPDATE [Server2].Orders.dbo.OrderHistory
> SET Salesperson = @.Salesperson
> WHERE OrderNumber = @.OrderNumber
> -- This uses a remote query; same table and index structure; linked server
> defined the same
> UPDATE [Server3].Orders.dbo.OrderHistory
> SET Salesperson = @.Salesperson
> WHERE OrderNumber = @.OrderNumber
> I can't figure out any reason why it does it that way. To make things
> more
> odd, that proc updates a couple other servers in the same way for the same
> table and those use remote queries. The linked servers are defined the
> same,
> the table structure and indexes are the same.
> Does anyone have any idea why it would work this way?
> Thanks.
> Dale.
>
|||Thanks for the reply.
The data types are the same.
I've tried several variations of OPENQUERY syntax but it doesn't like
variables in its parameters, so I'm not sure how to get the update done.
Plus, I'd sorta like to know why anyways.
"Andrew J. Kelly" wrote:

> Is it possible the datatypes of those declared variables are not equal to
> the corresponding data types on the linked server? In any case you should
> try using OPENQUERY() as it will pass thru all queries so they are always
> interpreted on the other side just as you wrote them with no odbc
> intervention.
> --
> Andrew J. Kelly SQL MVP
> "Dale M." <DaleM@.discussions.microsoft.com> wrote in message
> news:5EAABBC0-BFF8-4DC6-BF0C-911DBAAB5B5C@.microsoft.com...
>
>

Remote Restore via Linked Server

Hi, I'm initiating a restore via a linked server and an SQL Agent Job. The
job completes successfully in about 10 minutes, but the backup is left in a
loading state. This suggests that the connection timed out. Any thoughts
on how to make this more robust? (possibly start an SQL Agent job on the
remote server from the parent server')
Thanks
Bill"Bill Swartz" <swartz.bill@.gmail.com> wrote in message
news:ueVmqUqrGHA.1732@.TK2MSFTNGP03.phx.gbl...
> Hi, I'm initiating a restore via a linked server and an SQL Agent Job.
> The job completes successfully in about 10 minutes, but the backup is left
> in a loading state. This suggests that the connection timed out. Any
> thoughts on how to make this more robust? (possibly start an SQL Agent
> job on the remote server from the parent server')
>
That's what I would do.
David|||Answering my own question to some degree, initiating the remote procedure
via an SQL Agent job on the remote server works fine. (or in other words it
does not time out). But, it also flags the step on the host server
immediately as successful.
What I'm looking for is a way for the job to wait, or at least report the
status of the restore back to the host server.
Bill
"Bill Swartz" <swartz.bill@.gmail.com> wrote in message
news:ueVmqUqrGHA.1732@.TK2MSFTNGP03.phx.gbl...
> Hi, I'm initiating a restore via a linked server and an SQL Agent Job.
> The job completes successfully in about 10 minutes, but the backup is left
> in a loading state. This suggests that the connection timed out. Any
> thoughts on how to make this more robust? (possibly start an SQL Agent
> job on the remote server from the parent server')
> Thanks
> Bill
>|||This is a multi-part message in MIME format.
--050606090705070603040506
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Bill S wrote:
> Answering my own question to some degree, initiating the remote procedure
> via an SQL Agent job on the remote server works fine. (or in other words it
> does not time out). But, it also flags the step on the host server
> immediately as successful.
> What I'm looking for is a way for the job to wait, or at least report the
> status of the restore back to the host server.
> Bill
> "Bill Swartz" <swartz.bill@.gmail.com> wrote in message
> news:ueVmqUqrGHA.1732@.TK2MSFTNGP03.phx.gbl...
>> Hi, I'm initiating a restore via a linked server and an SQL Agent Job.
>> The job completes successfully in about 10 minutes, but the backup is left
>> in a loading state. This suggests that the connection timed out. Any
>> thoughts on how to make this more robust? (possibly start an SQL Agent
>> job on the remote server from the parent server')
>> Thanks
>> Bill
>>
>
>
Hi
I've done a similar thing with a DTS package. In the package there's a
connection to the remote server and then a step that runs a restore on
that server. The package will not finish the execution until the restore
is done so that will give you what you want.
Regards
Steen Schlüter Persson
Databaseadministrator / Systemadministrator
--050606090705070603040506
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Bill S wrote:
<blockquote cite="mid%237WfcfqrGHA.1140@.TK2MSFTNGP05.phx.gbl"
type="cite">
<pre wrap="">Answering my own question to some degree, initiating the remote procedure
via an SQL Agent job on the remote server works fine. (or in other words it
does not time out). But, it also flags the step on the host server
immediately as successful.
What I'm looking for is a way for the job to wait, or at least report the
status of the restore back to the host server.
Bill
"Bill Swartz" <a class="moz-txt-link-rfc2396E" href="http://links.10026.com/?link=mailto:swartz.bill@.gmail.com"><swartz.bill@.gmail.com></a> wrote in message
<a class="moz-txt-link-freetext" href="http://links.10026.com/?link=news:ueVmqUqrGHA.1732@.TK2MSFTNGP03.phx.gbl">news:ueVmqUqrGHA.1732@.TK2MSFTNGP03.phx.gbl</a>...
</pre>
<blockquote type="cite">
<pre wrap="">Hi, I'm initiating a restore via a linked server and an SQL Agent Job.
The job completes successfully in about 10 minutes, but the backup is left
in a loading state. This suggests that the connection timed out. Any
thoughts on how to make this more robust? (possibly start an SQL Agent
job on the remote server from the parent server')
Thanks
Bill
</pre>
</blockquote>
<pre wrap=""><!-->
</pre>
</blockquote>
<font size="-1"><font face="Arial">Hi<br>
<br>
I've done a similar thing with a DTS package. In the package there's a
connection to the remote server and then a step that runs a restore on
that server. The package will not finish the execution until the
restore is done so that will give you what you want.<br>
<br>
<br>
-- <br>
Regards<br>
Steen Schlüter Persson<br>
Databaseadministrator / Systemadministrator<br>
</font></font>
</body>
</html>
--050606090705070603040506--