Connect command

  • Hi,

    Is there any command equivalent in SQL Server as to "Connect" command in Oracle to connect to a database (connect username/password@hostname).I tried to connect to SQL server in Query Analyser with same syntax but it didnt works.

     

    Regards

    Gurpreet 

  • There is no direct equivalent in T-SQL, but you can accomplish the same thing usually, depending on what you want to do. Could you clarify a bit what it is you are trying to accomplish?

    Are you attempting to switch databases within a script? If so, the USE command should help. You can also use the database.owner.object syntax if you need to work with something in a different database.

    Are you attempting to switch to a different SQL Server? If so, you can either connect to it via Query Analyzer, register it in Enterprise manager, or use linked servers, for instance.

     

  • I'm not familiar with Oracle, but you might want to check out the stored procedures

    sp_addlinkedserver

    sp_addlinkedsrvlogin

    They help you run queries on another server.

    /HL

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply