Run "USE" with linked server alternatives

I am using SQL server linked servers and find some difficulties while running queries.
Below is the actual query.
USe testdb
SELECT COLUMNPROPERTY( OBJECT_ID('Table_1'),'column1','IsIdentity')
It returns 1 as column1 is identity column 
To run it to a linked server I used
Use mylinkedserver.testdb
SELECT COLUMNPROPERTY(OBJECT_ID('Table_1'),'column1','IsIdentity') 
But when I run this I get error as shown below Database 'mylinkedserver' does not exist. Make sure that the name is entered correctly.
Where as I can query the table by using select * from pc91sql.testdb.dbo.Table_1 successfully.
Then i used OPENQUERY option
SELECT * FROM OPENQUERY(pc91sql,'SELECT COLUMNPROPERTY( OBJECT_ID(''testdb.dbo.Table_1''),''column1'',''IsIdentity'')');
It returned NULL. But it should have returned 1 as column1 is a identity column.
Then I checked again running my original query directly in the linked server without use command and NULL is returned . If I run same query after I mention use testdb or in SSMS after choosing database from list then it returns 1 .So it means OBJECT_ID is not
able to use database name along with table name(i.e like ''testdb.dbo.Table_1'').
So how to run the above query?(I think i cannot make use of "USE" with linked server.So what is the alternative 

One way to accomplish what you want to do is by using dynamic SQL.  For example:
execute [mylinkedserver].master.dbo.sp_executesql N'USe testdb SELECT COLUMNPROPERTY( OBJECT_ID(''Table_1''),''column1'',''IsIdentity'')'

Similar Messages

  • Tablediff with linked server

    Hi,
    i have created a linked server that point to a firebird database,
    everything is fine , i can query the database with something like
    Select * from MYLINKEDSERVER...MYTABLE
    now , can i use tablediff utility with this linked server .
    if yes can you please give me an example  .
    i would say also that performance is not very important to me,
    this would be used at the end of the day to make some sort of replication by generating a sql script with datadiff, and run it on a local sql server database and a web based SQL database
    ps : the replication is not an option since i am using a shared web hosting and replication is disabled on it .
    thanks and good day

    First thing to note is that
    The tablediff utility cannot be used with non-SQL Server servers.
    Are you trying to directly do tablediff with linked server table?
    Cant you bring data to a local table and then do tablediff?
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Memory leak issue with link server between SQL Server 2012 and Oracle

    Hi,
    We are trying to use the linked server feature with SQL Server 2012 to connect SQL server and Oracle database. We are concerned about the existing memory leak issue.  For more context please refer to the link.
    http://blogs.msdn.com/b/psssql/archive/2009/09/22/if-you-use-linked-server-queries-you-need-to-read-this.aspx
    The above link talks about the issues with SQL Server versions 2005 and 2008, not sure if this is still the case in 2012.  I could not find any article that talks about if this issue was fixed by Microsoft in later version.
    We know that SQL Server process crashes because of the third-party linked server provider which is loaded inside SQL Server process. If the third-party linked server provider is enabled together with the
    Allow inprocess option, the SQL Server process crashes when this third-party linked server experiences internal problems.
    We wanted to know if this fixed in SQL Server 2012 ?

    So your question is more of a information type or are you really facing OOM issue.
    There can be two things for OOM
    1. There is bug in SQL Server which is causing the issue which might be fixed in 2012
    2. The Linked server provider used to connect to Oracle is not upto date and some patch is missing or more recent version is to be used.  Did you made sure that you are using latest version.
    What is Oracle version you are trying to connect(9i,10g, R2...)
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP

  • Configuring Cisco Router for use with Syslog Server

    Configuring Cisco Router for use with Syslog Server:
    Does anyone know of a good doc for this?
    -Ashley

    Start with that one: http://security-planet.de/wp-content/uploads/2008/12/logging-ios.pdf
    And if you need more informations, just ask what you want to achieve.
    Don't stop after you've improved your network! Improve the world by lending money to the working poor:
    http://www.kiva.org/invitedby/karsteni

  • BEA Workshop for WebLogic Platform9.2  can use with weblogic server 9.1?

    Wanted to know whether BEA Workshop for WebLogic Platform9.2 can be used with weblogic server 9.1?. If it cannot be used then which ide we need to use to build the j2ee application to deploy on to weblogic server 9.1

    try http://edelivery.oracle.com
    accept the licenses and in the next screens
    "Select a Product Pack" select Oracle BEA
    and your platform (i.e. Windows)
    then select the media pack you want
    i.e. "BEA WebLogic Media Pack for Linux x86"
    and voila!
    "WebLogic Platform 10.2 for Microsoft Windows (32-bit)"
    (in the Platform includes WebLogic Server, Workshop for WebLogic, WebLogic Portal and WebLogic Integration)
    ./ydes

  • Problem with linked server...error 7302

    I have a very perplexing problem with a linked server.
    We are running SQL Server 2008 on Windows Server 2003. We have two instances, PROD and TEST. Both instances have a linked server to a DB2 environment using the IBMDADB2 driver. Both linked servers are identical. Up until a few days ago, both linked servers worked fine. Suddenly, I started to receive the following error when trying to access the linked server on TEST:
    Msg 7302, Level 16, State 1, Procedure sp_testlinkedserver, Line 1
    Cannot create an instance of OLE DB provider "IBMDADB2.DB2COPY1" for linked server "cm_nw".
    I have tried *everything* save restart the server (which is going to come tonight), reregistering the .dll and querying through openrowset (openquery and testing the connection in SSMS both fail). This includes:
    1) Recreating the linked server
    2) Going into DCOM and modifying the msdainitialize and checking the permissions.
    I am logging into the server using Windows Authentication, but this has worked and nothing has changed on that instance at all. I'm in the Administrators group anyway, as is the SQL Server service account, and that group has permissions on MSDAINITIALIZE. There is nothing in the SQL Server or Windows logs to indicate why the linked server cannot be called.
    Note the linked server is set up to use a security context (user name and password) and both linked servers are identical in this aspect. If I recreate the linked server without a password and uncheck "Allow Inprocess" in the provider I get:
    The OLE DB provider "IBMDADB2.DB2COPY1" for linked server "CM_NW" reported an error. Authentication failed.
    Cannot initialize the data source object of OLE DB provider "IBMDADB2.DB2COPY1" for linked server "CM_NW".
    OLE DB provider "IBMDADB2.DB2COPY1" for linked server "CM_NW" returned message " SQL30082N  Security processing failed with reason "3" ("PASSWORD MISSING").  SQLSTATE=08001
    ". (Microsoft SQL Server, Error: 7399)
    I don't know if that is coming from the SQL Server end or the DB2 end.

    I was able to resolve this issue by editing the registry. I imported a registry file called "IBM DB2 ODBC Driver - DB2 X64" from one of my known working servers that has a linked DB2 server installed. So what I'm thinking is happening is that SQL
    Server is somehow editing the registry causing it to break. 
    If you can go through the ODBC administrator and test your connection successfully, than you will know that the problem is not DB2 Connect but it's actually SQL Server. 
    For anyone that is still having this issue I would look in the registry for any DB2 X64 drivers to see if you have any. If not you can always create the following registry file and call it "IBM DB2 ODBC Driver - DB2 X64.reg" .
    Windows Registry Editor Version 5.00
    [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI\ODBC Drivers]
    "SQL Server"="Installed"
    "Microsoft ODBC for Oracle"="Installed"
    "Microsoft Access Driver (*.mdb)"="Installed"
    "Microsoft Access-Treiber (*.mdb)"="Installed"
    "Driver do Microsoft Access (*.mdb)"="Installed"
    "Microsoft dBase Driver (*.dbf)"="Installed"
    "Microsoft dBase-Treiber (*.dbf)"="Installed"
    "Driver do Microsoft dBase (*.dbf)"="Installed"
    "Microsoft Excel Driver (*.xls)"="Installed"
    "Microsoft Excel-Treiber (*.xls)"="Installed"
    "Driver do Microsoft Excel(*.xls)"="Installed"
    "Microsoft Paradox Driver (*.db )"="Installed"
    "Microsoft Paradox-Treiber (*.db )"="Installed"
    "Driver do Microsoft Paradox (*.db )"="Installed"
    "Microsoft Text Driver (*.txt; *.csv)"="Installed"
    "Microsoft Text-Treiber (*.txt; *.csv)"="Installed"
    "Driver da Microsoft para arquivos texto (*.txt; *.csv)"="Installed"
    "Microsoft Visual FoxPro Driver"="Installed"
    "Microsoft FoxPro VFP Driver (*.dbf)"="Installed"
    "Microsoft dBase VFP Driver (*.dbf)"="Installed"
    "Microsoft Visual FoxPro-Treiber"="Installed"
    "Driver para o Microsoft Visual FoxPro"="Installed"
    "SQL Server Native Client 10.0"="Installed"
    "IBM DB2 ODBC DRIVER - DB2x64"="Installed"
    "Microsoft Access Driver (*.mdb, *.accdb)"="Installed"
    "Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)"="Installed"
    "Microsoft Access dBASE Driver (*.dbf, *.ndx, *.mdx)"="Installed"
    "Microsoft Access Paradox Driver (*.db)"="Installed"
    "Microsoft Access Text Driver (*.txt, *.csv)"="Installed"
    "IBM INFORMIX ODBC DRIVER"="Installed"
    "ServiceNow ODBC Driver 32-bit"="Installed"
    "IBM DB2 ODBC DRIVER - DB2COPY1"="Installed"
    "IBM DB2 ODBC DRIVER"="Installed"
    Once you've created this file go ahead and create a backup(if desired) of the registry and execute the reg file and restart SQL Server to see if this resolves your issue. If this does resolve your issue I would recommend taking a backup of your registry
    in case it breaks again. Keep in mind, other applications may experience issues that have been changed if you revert back to the backup.
    Hope this helps!

  • Oracle InstantClient with Linked Server in Sql Server 2005

    We are trying to connect ORACLE server from sql server 2005 using Linked Server Feature in SqlServer 2005
    Generally Oracle Client software is needed for this activity in the sql server machine.
    Can we use "Oracle InstantClient" instead of "Oracle Client Software" to connect ORACLE using Linked Servers ?
    Please give us your views, any existing reports similar to this activity
    Thanks & Regards,
    Palani

    Thanks for your reply
    I agree that Oracle Client software is used to connect oracle from SQL SERVER 2005.
    But my doubt is can we use Oracle InstantClient instead of Oracle Client software to connect oracle from SQL SERVER 2005
    with respect to Oracle Instant Client - I would like to know the development steps (Not the installation steps of Oracle Instant Client in windows machine) to connect ORACLE server.
    Thanks & Regards,
    Palani

  • Mac OS X Server 4.1, Xcode 6.3.1 "This version of Xcode cannot be used with this server"

    I'm utterly confused.
    The documentation for Mac OS X Server (from https://help.apple.com/serverapp/mac/4.0/#/apdA154F061-7CE4-4A58-843D-DC2CE3A1AE 8C ) shows that Xcode 6 or later (my emphasis). I have installed Mac OS X 10.10.3, Mac OS X Server 4.1, Xcode 6.3.1. I have no apps in the App Store's "Update" tab that need to be updated (just now double-checked). I clicked to the Xcode tab under "Services" in OS X Server, clicked the "Choose Xcode…" button, selected the version of Xcode from the Applications folder on the root HDD, and got the error message "This version of Xcode cannot be used with OS X Server."
    So .... now what?

    Well, for some reason it just started working.  I was busy trying to fix another issue when I noticed that the Xcode service was running.  I would still like to know what happened in case I have a similar problem with the next OS/Server upgrade, but for now it's at least running.

  • Trigger problem on Sql Server with linked server to Oracle

    Hi All,
    I have a simple insert trigger on Sql Server 2005, it uses linked server to Oracle.
    like that ;
    USE [YTM08]
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ANSI_NULLS ON
    go
    ANSI_WARNINGS ON
    CEATE TRIGGER [dbo].[YTM_TBLSTSABIT_I]
    ON [dbo].[TBLSTSABIT] FOR INSERT
    AS
    BEGIN
    INSERT INTO YTM_ORACLE..SECTOR.STOCKS
    stock_name,
    stock_code,
    insert_date
    SELECT
    SBT.STOCKNAME,
    SBT.STOCKCODE,
    GETDATE()
    FROM INSERTED SBT
    END
    The YTM_ORACLE is a linked server and it's provider is OraOLEDB.Oracle.
    Trigger does not works for that linked server but other triggers for local
    sql server works fine...
    I get this error from sql server
    'Heterogeneous queries require the ANSI_NULLS and
    ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.'
    Does someone know how to solve this issue the right way?
    Thanks in advance.
    Thanks !
    Adam

    Hi Lars,
      Thanks for the data. I've already read this note and configure all this parameters. But when I'm executing the Create Source System in the BI system the process dies.
      If I look into the logs I see this:
    M  call semaphore clean-up function ...
    M  ***LOG Q0E=> DpSigGenHandler, Exception (c06d007e) [dpnttool.c   432]
      That's the reason why I start guessing about other possible problem.
    Regards

  • 1. Will CAL Licenses works if i use Windows Server 2012? 2. What GB of RAM can be used with Windows Server 2008 Standard Edition?

    I have been using Windows Server 2008 Standard Edition for my business purpose and there are at-least 30 Users who logged in into the server Via Remotely from different location. I want to upgrade my server with latest one with some extra cores and RAM for
    better and smooth operations for all users. So, i have a doubt whether my CAL Licenses will works with Windows Server 2012 or i need to purchase the new one for the same? 
    Moreover, if i don't upgrade my Windows to any 2012 edition and stay on 2008 Standard Edition how much maximum RAM can be installed at a time? is there any limitations? if Yes, please let me know how do i upgrade my Windows 2008 Standard Edition to any other
    business edition to avoid such limitations of RAM?
    Waiting for your favorable and quick response. 

    Hi again,
    th eupgrade optiuon from Standard 2008 to Enterprise 2008 was only available for customers with open value contract with activ esoftware assurance then they can purchase the step up license from Standard to Enterprise.
    the only way to have the Enterprise 2008 Edition is to make th edowngrad efrom 2012 Standard to 2008 Enterprise. it means that if you purchase the 2012 R2 Standard Edition, you may downgarde to Enterprise 2008/2008 R2. th ebest way to make the downgrade
    to 2008 R2 Enterprise is to purchase the current Version 2012 R2 Standard in volume licensing than you can download diretly from VLSC the Enterprise Edition.
    with your downgrade you can still using the 2008 CALs.
    thanks
    diramoh

  • Error with Linked Server

    I am trying to configure a linked server to connect from MS Sqlserver2000 to Oracle.
    I am using an Oracle 8i client. Following notes on this website and from microsoft I changed
    my registery enteries as follows:
    OracleOciLib oci.dll
    OracleSqllib orasql8.dll
    OracleXalib oraclient.dll
    My odbc connection works when tested thru Oracle Network administation but when I try to look at any tables of the linked server (using MS Enterprise Manager) I get the following error:
    "Error 7399: OLE DB provider 'OraOleDB.Orcle' reported an error"
    This occurs when I use the oracle odbc
    When I use the microsoft odbc connector I get:
    "Error 7399: OLE DB provider 'ContextProvider.MSDAORA.1' reported an error"
    Any ideas.
    Thanks in advance.
    Patrick

    To view tables on an Oracle linked server in Enterprise manager you need to add a security context to use when there is no SQL Server user
    It's on the bottom of the "security" tab on the server properties page.

  • Issue with linked server

    We have created a linked server.We are getting below error when a trigger is executed from the source server.
    1)OLE DB provider "SQLNCLI" for linked server "Destination server" returned message "The partner transaction manager has disabled its support for remote/network transactions."
    2)Msg 7391, Level 16, State 2, Procedure trgScandetails, Line 21
    The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "Destination server" was unable to begin a distributed transaction.
    3)OLE DB provider "SQLNCLI" for linked server "Destination server" returned message "No transaction is active."
    Please help me on this.
    Thanks in advance.

    Using triggers are bad, things like this make it more worse. 
    I would say that using triggers in general is not bad, but it is a good way to implement validation of business rules which cannot be encoded in constraints, as well various forms of cascading updates. In short, any thing which is needed to uphold database
    integrity.
    But from this follows that as soon you stray outside the database you are doing something more. Maybe you have distributed your data over more than one database for some reason, and it is still a matter of referential integrity. If the databases are different
    applications, it is probably not the correct solution.
    And maybe you distributed your databases over several servers for load balancing or whatever. But then at the same time you also increase the complexity of your solution considerably. For instance, what happens if you have a disaster and must restore one
    of the databases?
    As for the actual question, getting MSDTC to work can be a breeze - and it can be a nightmare. My experience is that if you have a domain and there are no trust or double-hop issues, it works. But if you don't have a domain, but only a workgroup it can
    be very difficult. It may work if the service accounts on the machines have the same name and password.
    But you should also ask yourself: if the other server is down, what do you want to happen?
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Which mail client do I use with iCal server?

    I will soon have os x server, and I want to use iCal server with mail. I want to schedule meetings, etc., like Exchange. However, many people have Outlook. Some have Entourage. Will these clients with with iCal for scheduling meetings and if not which client can I use? Thank you.

    Which Platform are the clients?
    Apple Mail does not work directly with iCal server. The Leopard version of iCal is what is used for scheduling. Mail is not like Outlook on PC or Entourage on the Mac where email, calendering and contacts are in one application. Leopard uses Mail, iCal, Address Book to provide similar functions.
    Also check out this doc
    http://images.apple.com/server/macosx/docs/iCalService_Admin_v10.5_2ndEd.pdf
    Tells you all the 3rd Party client apps that work with iCal Server.

  • Which version of Workshop to use with WebLogic Server 10.0 for 64-bit Linux

    I've downloaded and installed the 64-bit version of WebLogic Server for Linux. It is running on a 64-bit Xeon RHEL 5 machine with 64-bit Sun JVM.
    During the install, I selected WebLogic Server and Weblogic Workshop but it appears that Workshop was not installed. Apparently, only the Runtime for Workshop was installed. I'm not really sure what good that does for me.
    We need to use the Workshop IDE to develop apps. Is there a 10.0 version of Workshop for 64-bit Linux?

    Hi Anup,
    Maybe you should be a bit more specific about what you want to do. Coherence is just Java and has been supported WebLogic for years in the same way most other third-party Java libraries and APIs are. I first started using Coherence about four or five years ago with WebLogic 8.
    JK

  • How many video chats can you use with this server?

    I am looking to develop a multi-video chat app that's easy to
    build. Can I use Stratus with this? Or do I need to use FMS.

    none of the video streams will pass through Stratus. Stratus
    only enables end-to-end streams. You are limited only by the amount
    of bandwidth the client ends have as far as how many different
    streams can be flowing.
    if you need to relay streams through a server (the to-many
    case, or the end-to-end is blocked by firewalls or certain NAT
    configurations cases), you'll need to use FMS.
    -mike

Maybe you are looking for