Monday, February 20, 2012

Please Help! How to get list of SQL Servers in LAN?

Hello,
Is it possible to get list of SQL Servers existed in the LAN (on VC++)?
Thanks in advance,
Pola
Pola
I'm an expert of VC++ but it works onVB6
Dim i As Integer
'Use the SQL DMO Application Object to find the
available SQL Servers
Set oSQLServerDMOApp = New SQLDMO.Application
'Don't show events
gShowServerEvents = False
Dim namX As NameList
Set namX = oSQLServerDMOApp.ListAvailableSQLServers
For i = 1 To namX.Count
txtServer.AddItem namX.Item(i)
Next
"Pola" <Pola@.discussions.microsoft.com> wrote in message
news:4B0C5500-CBBA-4573-B551-AFCAD1D647F8@.microsoft.com...
> Hello,
> Is it possible to get list of SQL Servers existed in the LAN (on VC++)?
> Thanks in advance,
> Pola
|||Thank you,
Is it possible to get an example on SQL?
Thanks in advance,
Pola
"Uri Dimant" wrote:

> Pola
> I'm an expert of VC++ but it works onVB6
> Dim i As Integer
> 'Use the SQL DMO Application Object to find the
> available SQL Servers
> Set oSQLServerDMOApp = New SQLDMO.Application
> 'Don't show events
> gShowServerEvents = False
> Dim namX As NameList
> Set namX = oSQLServerDMOApp.ListAvailableSQLServers
> For i = 1 To namX.Count
> txtServer.AddItem namX.Item(i)
> Next
>
>
>
>
> "Pola" <Pola@.discussions.microsoft.com> wrote in message
> news:4B0C5500-CBBA-4573-B551-AFCAD1D647F8@.microsoft.com...
>
>
|||Pola
CREATE PROCEDURE dbo.ListLocalServers
AS
BEGIN
SET NOCOUNT ON
CREATE TABLE #servers(sname VARCHAR(255))
INSERT #servers EXEC master..XP_CMDShell 'OSQL -L'
DELETE #servers WHERE sname='Servers:'
SELECT LTRIM(sname) FROM #servers WHERE sname != 'NULL'
DROP TABLE #servers
END
"Pola" <Pola@.discussions.microsoft.com> wrote in message
news:D5730D3E-9078-488A-B07E-59926C09F65F@.microsoft.com...[vbcol=seagreen]
> Thank you,
> Is it possible to get an example on SQL?
> Thanks in advance,
> Pola
> "Uri Dimant" wrote:
|||thank you very much,
Pola
"Uri Dimant" wrote:

> Pola
> CREATE PROCEDURE dbo.ListLocalServers
> AS
> BEGIN
> SET NOCOUNT ON
> CREATE TABLE #servers(sname VARCHAR(255))
> INSERT #servers EXEC master..XP_CMDShell 'OSQL -L'
> DELETE #servers WHERE sname='Servers:'
> SELECT LTRIM(sname) FROM #servers WHERE sname != 'NULL'
> DROP TABLE #servers
> END
>
> "Pola" <Pola@.discussions.microsoft.com> wrote in message
> news:D5730D3E-9078-488A-B07E-59926C09F65F@.microsoft.com...
>
>
|||Hello Uri,
This script display list of SQL servers only from the domain.
Is it possible to get list of the SQL servers in LAN?
Thank you in advance,
Pola
"Pola" wrote:
[vbcol=seagreen]
> thank you very much,
> Pola
> "Uri Dimant" wrote:

No comments:

Post a Comment