473,382 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Here's an Interesting 2 Questions

1. Is there any way to retrieve the name of the locally running SQL Server?
The reason I ask is that I'd like to retrieve the name of the default SQL
Server and all named instances, but only on the local machine.

2. Is it possible to copy a file to a specified directory on a remote
machine without using shares? For instance, I might have a file like
"MYDATA.TXT" on my local machine, but I'd like to copy it to the "C:\TEST"
directory on a specific server; there are no shares set up on the server.

Thanks,
Michael C.
Nov 16 '05 #1
2 1043
1. You'll need to enumerate the following key in the registry (assuming
you are running SQL Server 8.0):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL
Server\InstalledInstances

2. If there are no shares on the target machine there is no native way
to put a file on that server. However, most servers come with default
adminstration shares for each hard drive (\\ServerName\C$ for C:\).
So, provided you have administrator access to the server and the shares
exist you can copy your file to \\servername\c$\test\

Hope this helps,

Reinout Hillmann
SQL Server Product Unit

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Michael C wrote:
1. Is there any way to retrieve the name of the locally running SQL Server?
The reason I ask is that I'd like to retrieve the name of the default SQL
Server and all named instances, but only on the local machine.

2. Is it possible to copy a file to a specified directory on a remote
machine without using shares? For instance, I might have a file like
"MYDATA.TXT" on my local machine, but I'd like to copy it to the "C:\TEST"
directory on a specific server; there are no shares set up on the server.

Thanks,
Michael C.

Nov 16 '05 #2
Michael C wrote:
1. Is there any way to retrieve the name of the locally running SQL Server?
The reason I ask is that I'd like to retrieve the name of the default SQL
Server and all named instances, but only on the local machine.

2. Is it possible to copy a file to a specified directory on a remote
machine without using shares? For instance, I might have a file like
"MYDATA.TXT" on my local machine, but I'd like to copy it to the "C:\TEST"
directory on a specific server; there are no shares set up on the server.

Thanks,
Michael C.

For number 1)
Add a reference to the COM object Microsoft SQLDMO
Then play with the following code:

System.Text.StringBuilder sb = new System.Text.StringBuilder();
SQLDMO.ApplicationClass ac = new SQLDMO.ApplicationClass();
for(int i=1;i<=ac.ServerGroups.Count;i++)
{
sb.Append("ServerGroup: ");
sb.Append(ac.ServerGroups.Item(i).Name);
for(int j=1;j<=ac.ServerGroups.Item(i).RegisteredServers.C ount;j++)
{
sb.Append("\n");
sb.Append(ac.ServerGroups.Item(i).RegisteredServer s.Item(j).Name);
}
sb.Append("\r\n");
}
MessageBox.Show(sb.ToString());

For some reason, the array of Item(s) starts at 1 instead of 0.

--
Tales from the SharpSide
http://www.scottcreynolds.com
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: FAQPoster | last post by:
An HTML version of this document is available at: http://www.mvps.org/access/netiquette.htm Feeling left out? Alone? Wondering why everyone's ignoring you? Or why you're being flamed for what...
0
by: FAQPoster | last post by:
An HTML version of this document is available at: http://www.mvps.org/access/netiquette.htm Feeling left out? Alone? Wondering why everyone's ignoring you? Or why you're being flamed for what...
0
by: FAQPoster | last post by:
An HTML version of this document is available at: http://www.mvps.org/access/netiquette.htm Feeling left out? Alone? Wondering why everyone's ignoring you? Or why you're being flamed for what...
52
by: robert | last post by:
I'm very pleased to announce that Foundations of F#, the first book to be published on the F# programming, will finish its first printing run, tomorrow, Friday 25th May. It should reach any...
66
by: prady | last post by:
hi all, could any one solve the following C program. If any one knows the answer please post it Ques: A C function that will print 1 to N one per each line on the stdout , where N is a int...
93
by: lorlarz | last post by:
Here, let's see what you JavaScript programmers have got Here is a place to share your large or larger full-blown JavaScript applications: real.comp.lang.js.apps (a new google group) Here is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.