Accessing tables

  • Hi experts,

    I am connected to database1 and i want to select a table from database2 .... ...what i want to do for that... ...........any advices may be helpful

    [font="Comic Sans MS"]+++BLADE+++[/font]:cool:

  • If your database is on the same server, you just need to specify the database name in the query. The syntax below assumes that the table is in the dbo schema.

    SELECT * FROM Database2.dbo.TableName

  • thnks ken

    [font="Comic Sans MS"]+++BLADE+++[/font]:cool:

  • BLADE (5/6/2009)


    Hi experts,

    I am connected to database1 and i want to select a table from database2 .... ...what i want to do for that... ...........any advices may be helpful

    also use, OPENROWSET, to get the results from other server. for more info see SQL BOL.

  • If database1 and database2 are in diff servers then you can add one of the server as liked server to the other and run queries such as

    select * from scud.master.sys.databases

    which gives you the details of all the databases in the server "scud".

    Check out this:

    http://msdn.microsoft.com/en-us/library/ms188279.aspx

    http://msdn.microsoft.com/en-us/library/ms190312.aspx

    Tanx 😀

Viewing 5 posts - 1 through 4 (of 4 total)

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