Tuesday, December 4, 2007

How to issue Distributed query

How to issue Distributed query

To issue Distributed query

If you have added in a Linked Server you can issue query to your linked server by using the following codes.

set conn=Server.CreateObject("ADODB.Connection")

conn.Open "DSN=tenderproject;UID=tenderproject;PWD=tender"

set rs=Server.CreateObject("ADODB.Recordset")

sqlstr = SELECT * FROM OPENQUERY(ServerAliasName,"SELECT * FROM Database.dbo.table")

rs.open sqlstr, conn, 1,3

No comments: