Showing posts with label command. Show all posts
Showing posts with label command. Show all posts

Wednesday, March 28, 2012

linked server problem

I am facing this problem for partitioned views in sql server.

First I use the sp_addlinedserver command to add a server instance S2 into S1 and vice-versa on machine M

then I create two tables T1 and T2 in S1 and S2

When I issue the command on lets say S1 to create a view from
S1.pubs.dbo.T1 and S2.pubs.dbo.T2, it doesn't

Message says Server does not exist or access denied

If I try to include machine name as M\S1.pubs.dbo.T1 it says a syntax error at \.

Could not find any online help as well. Kindly helpTwo tips:

Your syntax for machine name should be:
[ServerName].[Database].[Owner].[ObjectName]

or

M.S1.dbo.T1

As for the linked server, you probably need to also run sp_addlinkedsrvlogin after sp_addlinkedserver to set up the proper security context to the linked server.

-b

Friday, March 9, 2012

Linked Server and db2/400

I have defined a linked server for db2/400. I have a sp on the db2 and when I execute the squel command I do not see any results:

Exec ('Call QGPL.getallcompanies') AT AS400SRV_IBMDASQL_OLEDB
Result: Command(s) completed successfully.

When I execute the same sp from iSeries navigator it shows me the result.

Could data be placed in a buffer since I cannot see them??

Also I am trying to change my query and use following (to see if that would show me the result):

select * from openquery (AS400SRV_IBMDASQL_OLEDB, 'Exec ('Call QGPL.getallcompanies')').

Here I get an error: Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'Call'.

Can anyone help?Try: (extra single quotes, not double)
select * from openquery (AS400SRV_IBMDASQL_OLEDB, 'Exec (''Call QGPL.getallcompanies'')').