本文介绍了如何查询链接的SQL Server数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有两台与局域网连接的机器,我在两台机器上都安装了SQL-2008,并且我使用了两台SQL服务器这个存储过程



  Exec  sp_addlinkedserver 
@ servername = ' CMSSERVER \SQLEXPRESS'
@srvproduct = ' SQLServer OLEDB Provider'
@ provider = ' SQLOLEDB'
@ datasrc = ' CMS_Syllabus'





现在我需要查询此服务器数据库,另一台机器。

我写了这个



从CMSSERVER \SQLEXPRESS.CMS_Syllabus.dbo.Admin_Details中选择*



bu我得到的错误是'\'附近的语法不正确



请告诉我我正确地做了这个,或者给我一些其他想法来实现这个。



我需要从我拥有的其他链接服务器上解除查询,请解释我如何制作它...



真的很高兴..



提前致谢。

问候,

Krunal Panchal

解决方案




Hello everyone,

I have two machines which are connected with LAN and i have SQL-2008 on both machine and i have linked both the SQL server by using this stored procedure

Exec sp_addlinkedserver
@servername = 'CMSSERVER\SQLEXPRESS',
@srvproduct='SQLServer OLEDB Provider',
@provider='SQLOLEDB',
@datasrc='CMS_Syllabus'



now i need to query this server database, from another machine.
I have written this

select * from CMSSERVER\SQLEXPRESS.CMS_Syllabus.dbo.Admin_Details

but the error i am getting is incorrect syntax near '\'

Please tell me am i doing this correctly , or give me some other idea to implement this.

I need to fire query on other linked server from the one which i have, please explain me how to make it..

Really stucked up..

Thanks in advance.
Regards,
Krunal Panchal

解决方案




这篇关于如何查询链接的SQL Server数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 21:12