Showing posts with label methods. Show all posts
Showing posts with label methods. Show all posts

Sunday, March 25, 2012

Determine database no longer in use - Redux

I've attempted a number of methods to capture whether
specific databases are in use. I've configured an alert
for each one to trigger if the number of Active
Transactions exceeds 0. If this occurs, a job is run
which sends me an email via SMTP.
The question I have right now is what qualifies as an
Active Transaction? I can't find any reference to the
specific performance conditions in the BOL, just how to
set them up. I make changes to a test database and
sometimes the alert fires and sometimes it doesn't.
Thanks for any insight.
AllenAllen
One way you could do it is to detach the databases you
think are not being used and wait to see if anyone
complains. If you do make a mistake you can attach again
very quickly.
Depending on your company and what the databases are used
for you may or may not be able to do this. I know I would
not be able to, but it would work.
You could also use profiler to see if there is any
activity on a database. You might have issues with that if
you need to run it for several days and you have other
active databases on the same server.
Hope this helps
John
John

Thursday, March 22, 2012

Detecting SQL Server 2000 vs 2005 instance

I have the following two questions:
1) I can use the ListAvailableSQLServers methods in SQL-DMO to get a list of
all the available sql servers (in the form of Namelist) but how can I detect
which ones are SQL Server 2000/MSDE 2000 instances and which ones are 2005
instances programmatically either using VB6 or C#?
2) If I have a few machines in my network and one of them has an instance
called
"mycomputer/myinstance", the method "ListAvailableSQLServers" does not list
it. Could that be related to the windows firewall being turned on?
--
ANeelimaYou'd want to use smo instead of dmo to interact with both sql2k5 and sql2k.
Take a look at Server.PingSqlServerVersion() method under
Microsoft.SqlServer.Management.Smo namespace.
--
-oj
"ANeelima" <neelima@.newsgroups.nospam> wrote in message
news:B178E81E-C9DA-46FC-B0FB-504537B030D3@.microsoft.com...
>I have the following two questions:
> 1) I can use the ListAvailableSQLServers methods in SQL-DMO to get a list
> of
> all the available sql servers (in the form of Namelist) but how can I
> detect
> which ones are SQL Server 2000/MSDE 2000 instances and which ones are 2005
> instances programmatically either using VB6 or C#?
> 2) If I have a few machines in my network and one of them has an instance
> called
> "mycomputer/myinstance", the method "ListAvailableSQLServers" does not
> list
> it. Could that be related to the windows firewall being turned on?
> --
> ANeelima|||Hi,
Thanks for your post!
From your description, I understand that:
Your 1st question was that you wanted to detect each SQL Server version
corresponding to each SQL Server instances.
Your 2nd question was that you found you couldn't get the list of all SQL
Server instances in your network via ListAvailableSQLServers.
If I have misunderstood, please let me know.
For the first question, I recommend you:
1) Create a SQLDMO.SQLServer object.
2) Connect to the SQL Server by server name.
3) Get the version information by the property SQLServer.VersionString or
SQLServer.VersionMajor.
For the second question, I recommend you check your network settings and
ensure your application machine can access any SQL Server instance.
I write a sample and get the named instances that my machine can access in
network:
SQLDMO.Application app = new SQLDMO.ApplicationClass();
SQLDMO.NameList nl = app.ListAvailableSQLServers();
for (int i = 0; i < nl.Count; ++i)
{
string s = nl.Item(i);
this.label1.Text += s + "\n";
}
If you have any other concerns, please feel free to let me know. It's my
pleasure to be of assistance.
+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
Others:
https://partner.microsoft.com/US/technicalsupport/supportoverview/
If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Thanks.
My application is in VB6.0. How can I use SMO from VB6.0? I can't
seem to find it in the list of references in VB6.0. What is the reference
name?
ANeelima
"oj" wrote:
> You'd want to use smo instead of dmo to interact with both sql2k5 and sql2k.
> Take a look at Server.PingSqlServerVersion() method under
> Microsoft.SqlServer.Management.Smo namespace.
> --
> -oj
>
> "ANeelima" <neelima@.newsgroups.nospam> wrote in message
> news:B178E81E-C9DA-46FC-B0FB-504537B030D3@.microsoft.com...
> >I have the following two questions:
> >
> > 1) I can use the ListAvailableSQLServers methods in SQL-DMO to get a list
> > of
> > all the available sql servers (in the form of Namelist) but how can I
> > detect
> > which ones are SQL Server 2000/MSDE 2000 instances and which ones are 2005
> > instances programmatically either using VB6 or C#?
> >
> > 2) If I have a few machines in my network and one of them has an instance
> > called
> > "mycomputer/myinstance", the method "ListAvailableSQLServers" does not
> > list
> > it. Could that be related to the windows firewall being turned on?
> >
> > --
> > ANeelima
>
>|||Well, I was hoping that I don't have to connect to the server to get the
version name.
I wanted to simply use ListAvailableSQLServers, get the namelist, loop
through the servers and find the version without connecting.
It appears like I can do that with SMO using something like
----
DataTable dataTable = SmoApplication.EnumAvailableSqlServers();
foreach (DataRow dataRow in dataTable.Rows )
{
row.Append(
"Server: " + dataRow["Name"] + " Version: " + dataRow["Version"]);
}
Console.WriteLine(row.ToString());
----
But I can't do that with SQLDMO.
My application is in VB6.0 and if I need to use SMO in VB6.0 how can I do
that?
--
ANeelima
"Charles Wang[MSFT]" wrote:
> Hi,
> Thanks for your post!
> From your description, I understand that:
> Your 1st question was that you wanted to detect each SQL Server version
> corresponding to each SQL Server instances.
> Your 2nd question was that you found you couldn't get the list of all SQL
> Server instances in your network via ListAvailableSQLServers.
> If I have misunderstood, please let me know.
> For the first question, I recommend you:
> 1) Create a SQLDMO.SQLServer object.
> 2) Connect to the SQL Server by server name.
> 3) Get the version information by the property SQLServer.VersionString or
> SQLServer.VersionMajor.
> For the second question, I recommend you check your network settings and
> ensure your application machine can access any SQL Server instance.
> I write a sample and get the named instances that my machine can access in
> network:
> SQLDMO.Application app = new SQLDMO.ApplicationClass();
> SQLDMO.NameList nl = app.ListAvailableSQLServers();
> for (int i = 0; i < nl.Count; ++i)
> {
> string s = nl.Item(i);
> this.label1.Text += s + "\n";
> }
> If you have any other concerns, please feel free to let me know. It's my
> pleasure to be of assistance.
> +++++++++++++++++++++++++++
> Charles Wang
> Microsoft Online Partner Support
> +++++++++++++++++++++++++++
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================> Business-Critical Phone Support (BCPS) provides you with technical phone
> support at no charge during critical LAN outages or "business down"
> situations. This benefit is available 24 hours a day, 7 days a week to all
> Microsoft technology partners in the United States and Canada.
> This and other support options are available here:
> BCPS:
> https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
> Others:
> https://partner.microsoft.com/US/technicalsupport/supportoverview/
> If you are outside the United States, please visit our International
> Support page:
> http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no rights.
>|||As long as SQL Browser service is online (and it should), you don't have to
connect to the SQL instances to check their versions. You can send a packet
to UDP 1434 and get the version info in the reply. If you don't want to
program sockets firectly, you can leverage the output of SQLPing.exe and
parse the result text for the instance names and their versions. You can find
SQLPing.exe via Google.
Linchi
"ANeelima" wrote:
> I have the following two questions:
> 1) I can use the ListAvailableSQLServers methods in SQL-DMO to get a list of
> all the available sql servers (in the form of Namelist) but how can I detect
> which ones are SQL Server 2000/MSDE 2000 instances and which ones are 2005
> instances programmatically either using VB6 or C#?
> 2) If I have a few machines in my network and one of them has an instance
> called
> "mycomputer/myinstance", the method "ListAvailableSQLServers" does not list
> it. Could that be related to the windows firewall being turned on?
> --
> ANeelima|||Unfortunately, SMO doesn't support COM. You might want to take a look at the
updated DMO.
"Microsoft SQL Server 2005 Backward Compatibility Components
The SQL Server Backward Compatibility package includes the latest versions
of Data Transformation Services 2000 runtime (DTS), SQL Distributed
Management Objects (SQL-DMO), Decision Support Objects (DSO), and SQL
Virtual Device Interface (SQLVDI). These versions have been updated for
compatibility with SQL Server 2005 and include all fixes shipped through SQL
Server 2000 SP4."
http://www.microsoft.com/downloads/details.aspx?familyid=D09C1D60-A13C-4479-9B91-9E8B9D835CDC&displaylang=en
--
-oj
"ANeelima" <neelima@.newsgroups.nospam> wrote in message
news:E9A07FEA-8F2F-40C5-BADE-599D41B88FB4@.microsoft.com...
> Thanks.
> My application is in VB6.0. How can I use SMO from VB6.0? I can't
> seem to find it in the list of references in VB6.0. What is the reference
> name?
>
> --
> ANeelima
>
> "oj" wrote:
>> You'd want to use smo instead of dmo to interact with both sql2k5 and
>> sql2k.
>> Take a look at Server.PingSqlServerVersion() method under
>> Microsoft.SqlServer.Management.Smo namespace.
>> --
>> -oj
>>
>> "ANeelima" <neelima@.newsgroups.nospam> wrote in message
>> news:B178E81E-C9DA-46FC-B0FB-504537B030D3@.microsoft.com...
>> >I have the following two questions:
>> >
>> > 1) I can use the ListAvailableSQLServers methods in SQL-DMO to get a
>> > list
>> > of
>> > all the available sql servers (in the form of Namelist) but how can I
>> > detect
>> > which ones are SQL Server 2000/MSDE 2000 instances and which ones are
>> > 2005
>> > instances programmatically either using VB6 or C#?
>> >
>> > 2) If I have a few machines in my network and one of them has an
>> > instance
>> > called
>> > "mycomputer/myinstance", the method "ListAvailableSQLServers" does not
>> > list
>> > it. Could that be related to the windows firewall being turned on?
>> >
>> > --
>> > ANeelima
>>|||Hi,
Thanks for your response.
SMO is included in SQL Server 2005. You can find the assemblies in:
"C:\Program Files\Microsoft SQL
Server\90\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll",
"C:\Program Files\Microsoft SQL
Server\90\SDK\Assemblies\Microsoft.SqlServer.Smo.dll",
"C:\Program Files\Microsoft SQL
Server\90\SDK\Assemblies\Microsoft.SqlServer.SmoEnum.dll",
"C:\Program Files\Microsoft SQL
Server\90\SDK\Assemblies\Microsoft.SqlServer.SqlEnum.dll"
You can directly add the references in VS.NET 2003/2005.
The assemblies names are:
Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Smo
Microsoft.SqlServer.SmoEnum
Microsoft.SqlServer.SqlEnum
If you want to use SMO in VB6, I recommend you use VS.Net 2003/2005 to wrap
the assembly into a COM library.
It's easy to realize this wrap in VS.Net 2003/2005.
You can refer to this article:
Can I Interest You in 5000 Classes?
Using the Full .NET Framework from Visual Basic 6
http://msdn.microsoft.com/vbrun/vbfusion/default.aspx?pull=/library/en-us/dv
_vstechart/html/VB5000Cl.asp
If you have any other concerns, please feel free to let me know. It's my
pleasure to be of assistance.
+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
Others:
https://partner.microsoft.com/US/technicalsupport/supportoverview/
If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi
How do you use the assemblies SMO if you don't install sql2005?
I have a web application in vs net 2003, and i have use de object
SQLServer for print a list of databases, tables, etc of other server
with sql2005
but in my server i don't have SQL2005, exist any client for that?
thanks
Charles Wang[MSFT] wrote:
> Hi,
> Thanks for your response.
> SMO is included in SQL Server 2005. You can find the assemblies in:
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.Smo.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.SmoEnum.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.SqlEnum.dll"
> You can directly add the references in VS.NET 2003/2005.
> The assemblies names are:
> Microsoft.SqlServer.ConnectionInfo
> Microsoft.SqlServer.Smo
> Microsoft.SqlServer.SmoEnum
> Microsoft.SqlServer.SqlEnum
> If you want to use SMO in VB6, I recommend you use VS.Net 2003/2005 to wrap
> the assembly into a COM library.
> It's easy to realize this wrap in VS.Net 2003/2005.
> You can refer to this article:
> Can I Interest You in 5000 Classes?
> Using the Full .NET Framework from Visual Basic 6
> http://msdn.microsoft.com/vbrun/vbfusion/default.aspx?pull=/library/en-us/dv
> _vstechart/html/VB5000Cl.asp
> If you have any other concerns, please feel free to let me know. It's my
> pleasure to be of assistance.
> +++++++++++++++++++++++++++
> Charles Wang
> Microsoft Online Partner Support
> +++++++++++++++++++++++++++
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================> Business-Critical Phone Support (BCPS) provides you with technical phone
> support at no charge during critical LAN outages or "business down"
> situations. This benefit is available 24 hours a day, 7 days a week to all
> Microsoft technology partners in the United States and Canada.
> This and other support options are available here:
> BCPS:
> https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
> Others:
> https://partner.microsoft.com/US/technicalsupport/supportoverview/
> If you are outside the United States, please visit our International
> Support page:
> http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi
How do you use the assemblies SMO if you don't install sql2005?
I have a web application in vs net 2003, and i have use de object
SQLServer for print a list of databases, tables, etc of other server
with sql2005
but in my server i don't have SQL2005, exist any client for that?
thanks
Charles Wang[MSFT] wrote:
> Hi,
> Thanks for your response.
> SMO is included in SQL Server 2005. You can find the assemblies in:
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.Smo.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.SmoEnum.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.SqlEnum.dll"
> You can directly add the references in VS.NET 2003/2005.
> The assemblies names are:
> Microsoft.SqlServer.ConnectionInfo
> Microsoft.SqlServer.Smo
> Microsoft.SqlServer.SmoEnum
> Microsoft.SqlServer.SqlEnum
> If you want to use SMO in VB6, I recommend you use VS.Net 2003/2005 to wrap
> the assembly into a COM library.
> It's easy to realize this wrap in VS.Net 2003/2005.
> You can refer to this article:
> Can I Interest You in 5000 Classes?
> Using the Full .NET Framework from Visual Basic 6
> http://msdn.microsoft.com/vbrun/vbfusion/default.aspx?pull=/library/en-us/dv
> _vstechart/html/VB5000Cl.asp
> If you have any other concerns, please feel free to let me know. It's my
> pleasure to be of assistance.
> +++++++++++++++++++++++++++
> Charles Wang
> Microsoft Online Partner Support
> +++++++++++++++++++++++++++
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================> Business-Critical Phone Support (BCPS) provides you with technical phone
> support at no charge during critical LAN outages or "business down"
> situations. This benefit is available 24 hours a day, 7 days a week to all
> Microsoft technology partners in the United States and Canada.
> This and other support options are available here:
> BCPS:
> https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
> Others:
> https://partner.microsoft.com/US/technicalsupport/supportoverview/
> If you are outside the United States, please visit our International
> Support page:
> http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi, xahaymar,
Thanks for your participation on this issue.
I need to appologize firstly I didn't perform a test that those SMO
assemblies are .net 2.0 assemblies and can't be applied in .net 1.1.
If you want to use the SMO assemblies you need to install SQL Server 2005.
Otherwise, you should use SQL-DMO.
However, you can install SQL Server 2005 Express on that machine. Those
assemblies are included in SQL 2005 Express.
SQL Server 2005 Express is free and you can directly download it from:
http://msdn.microsoft.com/vstudio/express/sql/download/
Enjoy your day!
+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/technicalsupport/supportoverview/40010469
Others:
https://partner.microsoft.com/US/technicalsupport/supportoverview/
If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/default.aspx?scid=%2finternational.aspx.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi Neelima,
I am interested in this issue. Would you mind letting me know the result of
the suggestions? If you need further assistance, feel free to let me know.
I will be more than happy to be of assistance.
Have a great day!
+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.sql

Detecting SQL Server 2000 vs 2005 instance

I have the following two questions:
1) I can use the ListAvailableSQLServers methods in SQL-DMO to get a list of
all the available sql servers (in the form of Namelist) but how can I detect
which ones are SQL Server 2000/MSDE 2000 instances and which ones are 2005
instances programmatically either using VB6 or C#?
2) If I have a few machines in my network and one of them has an instance
called
"mycomputer/myinstance", the method "ListAvailableSQLServers" does not list
it. Could that be related to the windows firewall being turned on?
ANeelimaYou'd want to use smo instead of dmo to interact with both sql2k5 and sql2k.
Take a look at Server.PingSqlServerVersion() method under
Microsoft.SqlServer.Management.Smo namespace.
-oj
"ANeelima" <neelima@.newsgroups.nospam> wrote in message
news:B178E81E-C9DA-46FC-B0FB-504537B030D3@.microsoft.com...
>I have the following two questions:
> 1) I can use the ListAvailableSQLServers methods in SQL-DMO to get a list
> of
> all the available sql servers (in the form of Namelist) but how can I
> detect
> which ones are SQL Server 2000/MSDE 2000 instances and which ones are 2005
> instances programmatically either using VB6 or C#?
> 2) If I have a few machines in my network and one of them has an instance
> called
> "mycomputer/myinstance", the method "ListAvailableSQLServers" does not
> list
> it. Could that be related to the windows firewall being turned on?
> --
> ANeelima|||Hi,
Thanks for your post!
From your description, I understand that:
Your 1st question was that you wanted to detect each SQL Server version
corresponding to each SQL Server instances.
Your 2nd question was that you found you couldn't get the list of all SQL
Server instances in your network via ListAvailableSQLServers.
If I have misunderstood, please let me know.
For the first question, I recommend you:
1) Create a SQLDMO.SQLServer object.
2) Connect to the SQL Server by server name.
3) Get the version information by the property SQLServer.VersionString or
SQLServer.VersionMajor.
For the second question, I recommend you check your network settings and
ensure your application machine can access any SQL Server instance.
I write a sample and get the named instances that my machine can access in
network:
SQLDMO.Application app = new SQLDMO.ApplicationClass();
SQLDMO.NameList nl = app.ListAvailableSQLServers();
for (int i = 0; i < nl.Count; ++i)
{
string s = nl.Item(i);
this.label1.Text += s + "\n";
}
If you have any other concerns, please feel free to let me know. It's my
pleasure to be of assistance.
+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/te...erview/40010469
Others:
https://partner.microsoft.com/US/te...upportoverview/
If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/defaul...rnational.aspx.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||Thanks.
My application is in VB6.0. How can I use SMO from VB6.0? I can't
seem to find it in the list of references in VB6.0. What is the reference
name?
ANeelima
"oj" wrote:

> You'd want to use smo instead of dmo to interact with both sql2k5 and sql2
k.
> Take a look at Server.PingSqlServerVersion() method under
> Microsoft.SqlServer.Management.Smo namespace.
> --
> -oj
>
> "ANeelima" <neelima@.newsgroups.nospam> wrote in message
> news:B178E81E-C9DA-46FC-B0FB-504537B030D3@.microsoft.com...
>
>|||Well, I was hoping that I don't have to connect to the server to get the
version name.
I wanted to simply use ListAvailableSQLServers, get the namelist, loop
through the servers and find the version without connecting.
It appears like I can do that with SMO using something like
----
DataTable dataTable = SmoApplication.EnumAvailableSqlServers();
foreach (DataRow dataRow in dataTable.Rows )
{
row.Append(
"Server: " + dataRow["Name"] + " Version: " + dataRow["Version"]);
}
Console.WriteLine(row.ToString());
----
--
But I can't do that with SQLDMO.
My application is in VB6.0 and if I need to use SMO in VB6.0 how can I do
that?
ANeelima
"Charles Wang[MSFT]" wrote:

> Hi,
> Thanks for your post!
> From your description, I understand that:
> Your 1st question was that you wanted to detect each SQL Server version
> corresponding to each SQL Server instances.
> Your 2nd question was that you found you couldn't get the list of all SQL
> Server instances in your network via ListAvailableSQLServers.
> If I have misunderstood, please let me know.
> For the first question, I recommend you:
> 1) Create a SQLDMO.SQLServer object.
> 2) Connect to the SQL Server by server name.
> 3) Get the version information by the property SQLServer.VersionString or
> SQLServer.VersionMajor.
> For the second question, I recommend you check your network settings and
> ensure your application machine can access any SQL Server instance.
> I write a sample and get the named instances that my machine can access in
> network:
> SQLDMO.Application app = new SQLDMO.ApplicationClass();
> SQLDMO.NameList nl = app.ListAvailableSQLServers();
> for (int i = 0; i < nl.Count; ++i)
> {
> string s = nl.Item(i);
> this.label1.Text += s + "\n";
> }
> If you have any other concerns, please feel free to let me know. It's my
> pleasure to be of assistance.
> +++++++++++++++++++++++++++
> Charles Wang
> Microsoft Online Partner Support
> +++++++++++++++++++++++++++
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
=============
> Business-Critical Phone Support (BCPS) provides you with technical phone
> support at no charge during critical LAN outages or "business down"
> situations. This benefit is available 24 hours a day, 7 days a week to all
> Microsoft technology partners in the United States and Canada.
> This and other support options are available here:
> BCPS:
> https://partner.microsoft.com/US/te...erview/40010469
> Others:
> https://partner.microsoft.com/US/te...upportoverview/
> If you are outside the United States, please visit our International
> Support page:
> http://support.microsoft.com/defaul...rnational.aspx.
> ========================================
=============
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>|||As long as SQL Browser service is online (and it should), you don't have to
connect to the SQL instances to check their versions. You can send a packet
to UDP 1434 and get the version info in the reply. If you don't want to
program sockets firectly, you can leverage the output of SQLPing.exe and
parse the result text for the instance names and their versions. You can fin
d
SQLPing.exe via Google.
Linchi
"ANeelima" wrote:

> I have the following two questions:
> 1) I can use the ListAvailableSQLServers methods in SQL-DMO to get a list
of
> all the available sql servers (in the form of Namelist) but how can I dete
ct
> which ones are SQL Server 2000/MSDE 2000 instances and which ones are 2005
> instances programmatically either using VB6 or C#?
> 2) If I have a few machines in my network and one of them has an instance
> called
> "mycomputer/myinstance", the method "ListAvailableSQLServers" does not lis
t
> it. Could that be related to the windows firewall being turned on?
> --
> ANeelima|||Unfortunately, SMO doesn't support COM. You might want to take a look at the
updated DMO.
"Microsoft SQL Server 2005 Backward Compatibility Components
The SQL Server Backward Compatibility package includes the latest versions
of Data Transformation Services 2000 runtime (DTS), SQL Distributed
Management Objects (SQL-DMO), Decision Support Objects (DSO), and SQL
Virtual Device Interface (SQLVDI). These versions have been updated for
compatibility with SQL Server 2005 and include all fixes shipped through SQL
Server 2000 SP4."
http://www.microsoft.com/downloads/...&displaylang=en
-oj
"ANeelima" <neelima@.newsgroups.nospam> wrote in message
news:E9A07FEA-8F2F-40C5-BADE-599D41B88FB4@.microsoft.com...[vbcol=seagreen]
> Thanks.
> My application is in VB6.0. How can I use SMO from VB6.0? I can't
> seem to find it in the list of references in VB6.0. What is the reference
> name?
>
> --
> ANeelima
>
> "oj" wrote:
>|||Hi,
Thanks for your response.
SMO is included in SQL Server 2005. You can find the assemblies in:
"C:\Program Files\Microsoft SQL
Server\90\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll",
"C:\Program Files\Microsoft SQL
Server\90\SDK\Assemblies\Microsoft.SqlServer.Smo.dll",
"C:\Program Files\Microsoft SQL
Server\90\SDK\Assemblies\Microsoft.SqlServer.SmoEnum.dll",
"C:\Program Files\Microsoft SQL
Server\90\SDK\Assemblies\Microsoft.SqlServer.SqlEnum.dll"
You can directly add the references in VS.NET 2003/2005.
The assemblies names are:
Microsoft.SqlServer.ConnectionInfo
Microsoft.SqlServer.Smo
Microsoft.SqlServer.SmoEnum
Microsoft.SqlServer.SqlEnum
If you want to use SMO in VB6, I recommend you use VS.Net 2003/2005 to wrap
the assembly into a COM library.
It's easy to realize this wrap in VS.Net 2003/2005.
You can refer to this article:
Can I Interest You in 5000 Classes?
Using the Full .NET Framework from Visual Basic 6
http://msdn.microsoft.com/vbrun/vbf...ibrary/en-us/dv
_vstechart/html/VB5000Cl.asp
If you have any other concerns, please feel free to let me know. It's my
pleasure to be of assistance.
+++++++++++++++++++++++++++
Charles Wang
Microsoft Online Partner Support
+++++++++++++++++++++++++++
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
Business-Critical Phone Support (BCPS) provides you with technical phone
support at no charge during critical LAN outages or "business down"
situations. This benefit is available 24 hours a day, 7 days a week to all
Microsoft technology partners in the United States and Canada.
This and other support options are available here:
BCPS:
https://partner.microsoft.com/US/te...erview/40010469
Others:
https://partner.microsoft.com/US/te...upportoverview/
If you are outside the United States, please visit our International
Support page:
http://support.microsoft.com/defaul...rnational.aspx.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi
How do you use the assemblies SMO if you don't install sql2005?
I have a web application in vs net 2003, and i have use de object
SQLServer for print a list of databases, tables, etc of other server
with sql2005
but in my server i don't have SQL2005, exist any client for that?
thanks
Charles Wang[MSFT] wrote:[vbcol=seagreen]
> Hi,
> Thanks for your response.
> SMO is included in SQL Server 2005. You can find the assemblies in:
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.Smo.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.SmoEnum.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.SqlEnum.dll"
> You can directly add the references in VS.NET 2003/2005.
> The assemblies names are:
> Microsoft.SqlServer.ConnectionInfo
> Microsoft.SqlServer.Smo
> Microsoft.SqlServer.SmoEnum
> Microsoft.SqlServer.SqlEnum
> If you want to use SMO in VB6, I recommend you use VS.Net 2003/2005 to wra
p
> the assembly into a COM library.
> It's easy to realize this wrap in VS.Net 2003/2005.
> You can refer to this article:
> Can I Interest You in 5000 Classes?
> Using the Full .NET Framework from Visual Basic 6
> [url]http://msdn.microsoft.com/vbrun/vbfusion/default.aspx?pull=/library/en-us/dv[/ur
l]
> _vstechart/html/VB5000Cl.asp
> If you have any other concerns, please feel free to let me know. It's my
> pleasure to be of assistance.
> +++++++++++++++++++++++++++
> Charles Wang
> Microsoft Online Partner Support
> +++++++++++++++++++++++++++
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
=============
> Business-Critical Phone Support (BCPS) provides you with technical phone
> support at no charge during critical LAN outages or "business down"
> situations. This benefit is available 24 hours a day, 7 days a week to all
> Microsoft technology partners in the United States and Canada.
> This and other support options are available here:
> BCPS:
> https://partner.microsoft.com/US/te...erview/40010469
> Others:
> https://partner.microsoft.com/US/te...upportoverview/
> If you are outside the United States, please visit our International
> Support page:
> http://support.microsoft.com/defaul...rnational.aspx.
> ========================================
=============
> This posting is provided "AS IS" with no warranties, and confers no rights.[/vbcol
]|||Hi
How do you use the assemblies SMO if you don't install sql2005?
I have a web application in vs net 2003, and i have use de object
SQLServer for print a list of databases, tables, etc of other server
with sql2005
but in my server i don't have SQL2005, exist any client for that?
thanks
Charles Wang[MSFT] wrote:[vbcol=seagreen]
> Hi,
> Thanks for your response.
> SMO is included in SQL Server 2005. You can find the assemblies in:
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.Smo.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.SmoEnum.dll",
> "C:\Program Files\Microsoft SQL
> Server\90\SDK\Assemblies\Microsoft.SqlServer.SqlEnum.dll"
> You can directly add the references in VS.NET 2003/2005.
> The assemblies names are:
> Microsoft.SqlServer.ConnectionInfo
> Microsoft.SqlServer.Smo
> Microsoft.SqlServer.SmoEnum
> Microsoft.SqlServer.SqlEnum
> If you want to use SMO in VB6, I recommend you use VS.Net 2003/2005 to wra
p
> the assembly into a COM library.
> It's easy to realize this wrap in VS.Net 2003/2005.
> You can refer to this article:
> Can I Interest You in 5000 Classes?
> Using the Full .NET Framework from Visual Basic 6
> [url]http://msdn.microsoft.com/vbrun/vbfusion/default.aspx?pull=/library/en-us/dv[/ur
l]
> _vstechart/html/VB5000Cl.asp
> If you have any other concerns, please feel free to let me know. It's my
> pleasure to be of assistance.
> +++++++++++++++++++++++++++
> Charles Wang
> Microsoft Online Partner Support
> +++++++++++++++++++++++++++
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
=============
> Business-Critical Phone Support (BCPS) provides you with technical phone
> support at no charge during critical LAN outages or "business down"
> situations. This benefit is available 24 hours a day, 7 days a week to all
> Microsoft technology partners in the United States and Canada.
> This and other support options are available here:
> BCPS:
> https://partner.microsoft.com/US/te...erview/40010469
> Others:
> https://partner.microsoft.com/US/te...upportoverview/
> If you are outside the United States, please visit our International
> Support page:
> http://support.microsoft.com/defaul...rnational.aspx.
> ========================================
=============
> This posting is provided "AS IS" with no warranties, and confers no rights.[/vbcol
]

Sunday, February 19, 2012

Design Question

I am in the design phase of a relational database using OO methods...I have three groups of people that I want to track...1. Students 2. Parents 3. Adult Volunteers...

I have started with a table called people where I have attributes that are common to all three groups of people...then I have a students table and volunteer table that have attributes common only to a student or volunteer...the key in these tables is also the FK of the people table. I think this is proper design.

Here is my question:

There is a many-many relationship with parents and students. A third junction table is needed I know but how is this accomplished with subtype tables...would I create the juntion between parents table and Students table or between parents table and people table?

Any suggestion would be appreciated. Maybe this is all wrong and someone has a better solution...thanks

Tonypost what the current fields are in each table and the relationships between them.|||You have identified that Students, Parents and Volunteers are all types of people, so you have created a People table with a primary key (PeopleID). In the Student and Voluteer tables there are keys that contain PeopleID.

The task is to show the relationship between a student and its parents. Students and Parents are all sub-types of People. What you are trying to define is a relationship from one person to another, so the design should link a record from the People table to another record in the People table.

The Parent table will have a PeopleID column that represents the student and a second column with a renamed PeopleID to represent the ID of the parent. You can then add any other columns that contain parent data. The primary key will be a compound key based on the first two columns.

Referencing column 1 will list all the people who are the parents of Student A. Referencing column 2 will list all the students of parent B.

By linking people records in this way you can also represent the relationship where a parent is also a student.

As the table can be used to represent any relationship between two people records, you may want to check if any other relationships need to be represented (Student A is the brother/sister of Student B etc.) If so, you could add a RelationshipID column to the table, add it to the primary key and change the name of the table.

Whether this is the best solution for you depends on all of your requirements. Hope you found this useful.