473,762 Members | 6,675 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connect MSSQL remotely by Query Analyzer

36 New Member
Hi,

I wish to know the syntax for connecting to a remote MSSQL 2000 DB Server via Query Analyzer.

Actually my requirement is to use the connection string to connect to the remote server, execute a SQL Statement on the remote server & save the resultset in a table on my local machine.

Can anybody helpme ?
Oct 17 '07 #1
2 3199
iburyak
1,017 Recognized Expert Top Contributor
Did you try something like this?



Expand|Select|Wrap|Line Numbers
  1. Insert into some_table
  2. SELECT a.*
  3. FROM OPENROWSET('MSDASQL',
  4.    'DRIVER={SQL Server};SERVER=seattle1;UID=sa;PWD=MyPass',
  5.    pubs.dbo.authors) AS a
  6. ORDER BY a.au_lname, a.au_fname

or this

Expand|Select|Wrap|Line Numbers
  1. insert into some_table
  2. SELECT   *
  3. FROM      OPENDATASOURCE(
  4.          'SQLOLEDB',
  5.          'Data Source=ServerName;User ID=MyUID;Password=MyPass'
  6.          ).Northwind.dbo.Categories
Oct 17 '07 #2
ankitmathur
36 New Member
Thanks a lot Dear.

Your code was exactly what I needed. I wasn't able to understand how to create a connection which your code helped me to.

Thank again.

Ankit Mathur


Did you try something like this?



Expand|Select|Wrap|Line Numbers
  1. Insert into some_table
  2. SELECT a.*
  3. FROM OPENROWSET('MSDASQL',
  4. 'DRIVER={SQL Server};SERVER=seattle1;UID=sa;PWD=MyPass',
  5. pubs.dbo.authors) AS a
  6. ORDER BY a.au_lname, a.au_fname

or this

Expand|Select|Wrap|Line Numbers
  1. insert into some_table
  2. SELECT *
  3. FROM OPENDATASOURCE(
  4. 'SQLOLEDB',
  5. 'Data Source=ServerName;User ID=MyUID;Password=MyPass'
  6. ).Northwind.dbo.Categories
Oct 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1641
by: Moco | last post by:
Well I installed my first OLAP Server ever just yesterday, allright. I built my first cube with a data source from a MSSQL Server 2000 on the same machine, allright. I browsed the cube with Analysis Manager, allright. Then , my real goal: I want to connect to OLAP Server in much the same way as I use to do with SQL Server, that is from my Domino Web Server, through Lotus Connectors over OLE DB provider. I thought I just needed to adapt my...
3
2894
by: JM | last post by:
Good day. I was able to connect to a database server using SQL Server Enterprise Manager. The Server name specified on the tree is JOMARGON(Windows NT). But no server was detected using either Visual Studio .NET and SQL Server's query analyzer. I highlighted one database (master) on the SQL Server Enterprise Manager and chose 'SQL Query Analyzer' under the 'Tools' menu. It worked. The Title of the Query Analyzer window is SQL Server...
4
1193
by: bthrnds-ns2 | last post by:
hey guys--i need some expert advice! we have a Dell PE 2650 with 2GHz and 2MB RAM with 2000 Server. on it we have about 6 MSSQL DB's. a couple of the DB's are the back-end for a decent sized web app (5-10 users on average, 20 users at most). many times, the cpu skyrockets on our db server when using the web app. sometimes things timeout, other times not. at this time, upgrading the hardware is not an option. aside from increasing the...
2
6046
by: lawk | last post by:
Hi, I am using MSSQL 2k, and I have a linked server set up to an Oracle RDB version 7. It goes thru an OLE DB provider for ODBC drivers on a system DSN, which is using an Oracle RDB ODBC driver version 3.0.2. The problem occurs when I send a query that returns zero rows - query analyzer just does not complete nor return. This problem is not seen when there are rows being returned.
1
1387
by: polinaskulski | last post by:
Hi, Is it possible to avoid the last used server being in Query Analyzer 'Connect to SQL Server' dialog by default(when I click on File/Connect in Query Analyzer) - I don't want to apply 'truncate table' scripts to a production server by mistake! Thanks
4
6019
by: kenneth.osenbroch | last post by:
Hi, I have a MSSQL Server communicating with an Oracle database through a MSSQL linked server using a MS ODBC connection. If I query the Oracle database through the Oracle ODBC 32Bit Test, the result is fine: select addrsurname from address where addrnr = 6666; HÅKANSSON
1
3120
by: Alfred | last post by:
Hi Guys, anyone out there who could help me with my problem? I have created a .bat file that would execute the mssql script and give an .txt file as an output. The script run successfully except for the output, the output save as .txt file was not in order unlike the output that was derrived from the query analyzer. As I try to solve my problem I observe that the lines separating the header and the data was the cause of un-order format, the...
0
1316
by: intergroove | last post by:
Help. This has been bugging me for a couple of days now: I am writing a script to regularly transfer data from a MYSQL db to a MSSQL. Being new to MSSQL I'm a bit freaked out about the UNIQUEIDENTIFER (UI) system. I have to INSERT data to a table where I need the UI for items from 2 other tables. This negates my ability to use a JOIN. So I need to grab the UI from within PHP and the reference the variable in the query.
4
1333
by: D | last post by:
Is it possible to connect to a .adp file? I'm pulling data from a sql server, but my files are stored on a different server? I'm not sure how to connect across servers so I thought using an .adp file would be the easiest solution?
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.