Showing posts with label enumerate. Show all posts
Showing posts with label enumerate. Show all posts

Thursday, March 29, 2012

enumerating sql servers in sql server 2005

Is there anyway new in SQL Server 2005 to enumerate all the servers on the
network without sqldmo? I'm working in .NET and want to get the list, im
doing it now in sqldmo and it works fine, but would like to do it with
managed code instead of using a com object...smo. It is the new dmo. :-)
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
***************************
Think Outside the Box!
***************************
"Brian Henry" wrote:

> Is there anyway new in SQL Server 2005 to enumerate all the servers on the
> network without sqldmo? I'm working in .NET and want to get the list, im
> doing it now in sqldmo and it works fine, but would like to do it with
> managed code instead of using a com object...
>
>|||Or use new ado.net class SqlDataSourceEnumerator, for example:
foreach (DataRow row in
SqlDataSourceEnumerator.Instance.GetDataSources().Rows)
{
Console.WriteLine(row["ServerName"].ToString());
}
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
"Brian Henry" <nospam@.nospam.com> wrote in message
news:%23ttiTlzBGHA.3840@.TK2MSFTNGP15.phx.gbl...
> Is there anyway new in SQL Server 2005 to enumerate all the servers on the
> network without sqldmo? I'm working in .NET and want to get the list, im
> doing it now in sqldmo and it works fine, but would like to do it with
> managed code instead of using a com object...
>|||thanks a lot!
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:%23DEvJk0BGHA.2840@.TK2MSFTNGP12.phx.gbl...
> Or use new ado.net class SqlDataSourceEnumerator, for example:
> foreach (DataRow row in
> SqlDataSourceEnumerator.Instance.GetDataSources().Rows)
> {
> Console.WriteLine(row["ServerName"].ToString());
> }
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
> "Brian Henry" <nospam@.nospam.com> wrote in message
> news:%23ttiTlzBGHA.3840@.TK2MSFTNGP15.phx.gbl...
>|||do you happen to know a way to list all the databases on a selected server
also with out having to log into it? SQLDMO let you do this before
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:%23DEvJk0BGHA.2840@.TK2MSFTNGP12.phx.gbl...
> Or use new ado.net class SqlDataSourceEnumerator, for example:
> foreach (DataRow row in
> SqlDataSourceEnumerator.Instance.GetDataSources().Rows)
> {
> Console.WriteLine(row["ServerName"].ToString());
> }
>
> --
> Miha Markic [MVP C#]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
> "Brian Henry" <nospam@.nospam.com> wrote in message
> news:%23ttiTlzBGHA.3840@.TK2MSFTNGP15.phx.gbl...
>|||whoops i made a mistake i didnt mean not logging in... in SQLDMO i'd do this
Dim oSQLServer As New SQLDMO.SQLServer
oSQLServer.LoginSecure = True
oSQLServer.Connect(s_Server)
Me.cboDatabaseList.Items.Clear()
For Each db As SQLDMO.Database In oSQLServer.Databases
If Not db.SystemObject Then
Dim dbName As String = db.name
Me.cboDatabaseList.Items.Add(dbName)
End If
End If
End If
End If
Next
how would you do that now without sqldmo?|||Here is how - http://blogs.msdn.com/sushilc/archi.../14/242395.aspx
- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.m...5/13/63199.aspx
________________________________________
__________________
"Brian Henry" <nospam@.nospam.com> wrote in message
news:%23ttiTlzBGHA.3840@.TK2MSFTNGP15.phx.gbl...
> Is there anyway new in SQL Server 2005 to enumerate all the servers on the
> network without sqldmo? I'm working in .NET and want to get the list, im
> doing it now in sqldmo and it works fine, but would like to do it with
> managed code instead of using a com object...
>

Enumerating Sql Server Databases

Hi. I would like to enumerate all the databases in a given Sql Server instance.

I've searched and found no information. Would somebody post a piece of VB code to do that?

Thanks in advance

Rafael

You can do it with an SQL string:

use masterselect *from sys.databases
|||

SELECT

*

FROM

master.sys.databases

Should work, but there is probably a more standard way.

|||There is also a stored procedure called:sp_databases

Enumerating Role Permissions with SMO

Hi,

I am attempting to enumerate role permissions using SMO. I can enumerate the permissions on a atbel, view, or store procedure no problem. When I try to enumerate the permissions that a role has I get the following error:

'Operation not supported on SQL Server 2000'

Can anyone help me in sorting this out. I had the permissions enumerated in DMO but I just can't seem to get it to work in SMO.

Thanks,

James

Just to make sure that I answer this correctly: are you connecting to SQL Server 2000 or SQL Servert 2005?|||

Hi,

I am connecting to SQL2K. I have not problem getting the permissions on a table, view, stored procedure, or function. Its only when I try to get the permissions for a role or user.

James

|||

SMO has aligned the meaning of User.EnumObjectPermissions with all other objects (such as Table). This means that you would enumerate the permissions that have granted or denied to a principal for a User object; not the permissions that have been granted to the User object (which represents a database user). SQL Server 2005 has implemented this (it was not possible for SQL Server 2000) so that clarifies the message you get.

You should be able to call Database.EnumObjectPermissions(User.Name) to obtain the results that you expect.

|||

Thanks,

that worked a treat.

James

|||

Hi,

I am also working on the table permissions.

ObjectPermissionInfo[] objPer = database.EnumObjectPermissions(database.UserName);


But, from this point how could I display all permissions for a table? Could you please send me a sample code?

Thanks in advance.

sql

Enumerating Role Permissions with SMO

Hi,

I am attempting to enumerate role permissions using SMO. I can enumerate the permissions on a atbel, view, or store procedure no problem. When I try to enumerate the permissions that a role has I get the following error:

'Operation not supported on SQL Server 2000'

Can anyone help me in sorting this out. I had the permissions enumerated in DMO but I just can't seem to get it to work in SMO.

Thanks,

James

Just to make sure that I answer this correctly: are you connecting to SQL Server 2000 or SQL Servert 2005?|||

Hi,

I am connecting to SQL2K. I have not problem getting the permissions on a table, view, stored procedure, or function. Its only when I try to get the permissions for a role or user.

James

|||

SMO has aligned the meaning of User.EnumObjectPermissions with all other objects (such as Table). This means that you would enumerate the permissions that have granted or denied to a principal for a User object; not the permissions that have been granted to the User object (which represents a database user). SQL Server 2005 has implemented this (it was not possible for SQL Server 2000) so that clarifies the message you get.

You should be able to call Database.EnumObjectPermissions(User.Name) to obtain the results that you expect.

|||

Thanks,

that worked a treat.

James

|||

Hi,

I am also working on the table permissions.

ObjectPermissionInfo[] objPer = database.EnumObjectPermissions(database.UserName);


But, from this point how could I display all permissions for a table? Could you please send me a sample code?

Thanks in advance.

enumerating registered sqlservers does not fill datatable complete

I've tried to enumerate sqlservers using two different methods and have the
same results... only the server name is returned, I am unable to get the
instance name so user will be unable to connect to selected server if it is
a
named instance (i.e. "Server"\SQLEXPRESS)...
Dim dt As DataTable
dt = SmoApplication.EnumAvailableSqlServers(False)
OR
Dim dt As DataTable
Dim instance As Sql.SqlDataSourceEnumerator =
Sql.SqlDataSourceEnumerator.Instance
dt = instance.GetDataSources
However I can go into SQL Server Management Studio, browse for servers and
every instance for every server (local and network) is listed... I assume
(foolishly) that MS Apps utilize thier own sdk's, if so why does it work
there but not for meOK I think I've found the culprit... the "Windows Firewall/Internet
Connection Sharing (ICS)" service
When I stop this service the enumerations return the Instance name and
Version of the SQL Servers... Hooray but what if Users have this service
running during my application installation? I'm suprised this isn't more of
a
known issue... I'm able to duplicate the issue on 2 machines both running XP
sp2 where one has SQL Server Express 2005 then other has SQL Server Express
2005 SP1, same results. Has anyone heard or exprienced this?

> I've tried to enumerate sqlservers using two different methods and have th
e
> same results... only the server name is returned, I am unable to get the
> instance name so user will be unable to connect to selected server if it i
s a
> named instance (i.e. "Server"\SQLEXPRESS)...
> Dim dt As DataTable
> dt = SmoApplication.EnumAvailableSqlServers(False)
> OR
> Dim dt As DataTable
> Dim instance As Sql.SqlDataSourceEnumerator =
> Sql.SqlDataSourceEnumerator.Instance
> dt = instance.GetDataSources
> However I can go into SQL Server Management Studio, browse for servers and
> every instance for every server (local and network) is listed... I assume
> (foolishly) that MS Apps utilize thier own sdk's, if so why does it work
> there but not for me|||On Tue, 13 Jun 2006 14:17:02 -0700, rqcoder
<rqcoder@.discussions.microsoft.com> wrote:
in <EF3759A0-3FE7-4839-B10E-E892752C02AB@.microsoft.com>

>OK I think I've found the culprit... the "Windows Firewall/Internet
>Connection Sharing (ICS)" service
>When I stop this service the enumerations return the Instance name and
>Version of the SQL Servers... Hooray but what if Users have this service
>running during my application installation? I'm suprised this isn't more of
a
>known issue... I'm able to duplicate the issue on 2 machines both running X
P
>sp2 where one has SQL Server Express 2005 then other has SQL Server Express
>2005 SP1, same results. Has anyone heard or exprienced this?
It happens on any machine that's running the firewall. It looks like
the tolerance window for the enumerations is extremely small - less than
a second. If anything hampers that initial query in the slightest then
the instance names don't show up. And I'm describing SQLDMO behavior
using VB6 but the enumerations code is most likely the same or extremely
similar.
What works well for me is Kerio Personal Firewall with specific rules
but that doesn't always wash well in the general user community.
Stefan Berglund

Enumerating jobs on a SQL server using SMO - in C#

Hi all, I'm trying to connect to SQL and enumerate all Agent jobs to find a
particular and call job.envoke on it.
Looked every where but can't find a code snippet on it or a sample.
Anyone can assist? CheersYou can use this to list all the jobs.
USE msdb
EXEC sp_help_job
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/|||Oops... Just read the subject line about SMO.. My fault..
You can try this link..
http://msdn2.microsoft.com/en-us/li...nt.
aspx
-Omnibuzz (The SQL GC)
http://omnibuzz-sql.blogspot.com/|||Thanks omnibuzz, I've tried that uri but since I'm new to SQL prog I haven't
figured out how to use for instance jobbasecollection classes to find out if
the job I'm interested in exist on the server.
Any help there with the code\implementation? Thanks.
"Omnibuzz" wrote:

> Oops... Just read the subject line about SMO.. My fault..
> You can try this link..
> http://msdn2.microsoft.com/en-us/li...n
t.aspx
> --
> -Omnibuzz (The SQL GC)
> http://omnibuzz-sql.blogspot.com/
>
>

enumerating all tables for size

Is there any SP or a function to enumerate all the tables
for their size for a given database... ?
Thanks
ArunTry this:
http://vyaskn.tripod.com/sp_show_biggest_tables.htm
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Arun" <anonymous@.discussions.microsoft.com> wrote in message
news:066901c3d959$d9e77fd0$a301280a@.phx.gbl...
Is there any SP or a function to enumerate all the tables
for their size for a given database... ?
Thanks
Arun|||Vyas,
thanks and it works as you say.. Since I am a novice in
SQL, i do not the size it displays.. will you please
explain about the size , for instance line below is one of
the largest table in my database
[dbo].[SoftwareFile] 6175326 355529.66
If the last number is in MB then its size is 355 Gig which
would be incorrect as my whole harddisk size itself is
300Gig and the whole database holding it is 70 Gig
Arun
quote:

>--Original Message--
>Try this:
>http://vyaskn.tripod.com/sp_show_biggest_tables.htm
>--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>Is .NET important for a database professional?
>http://vyaskn.tripod.com/poll.htm
>
>
>"Arun" <anonymous@.discussions.microsoft.com> wrote in

message
quote:

>news:066901c3d959$d9e77fd0$a301280a@.phx.gbl...
>Is there any SP or a function to enumerate all the tables
>for their size for a given database... ?
>Thanks
>Arun
>
>.
>
|||Run the following and see what it says:
EXEC sp_spaceused 'SoftwareFile'
If that reports the same size, then your sysindexes table is not accurate,
and you will have to run DBCC UPDATEUSAGE to fix that.
Look up SQL Server Books Online for more information on DBCC UPDATEUSAGE.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Arun" <anonymous@.discussions.microsoft.com> wrote in message
news:0af201c3d9eb$284ef130$a501280a@.phx.gbl...
Vyas,
thanks and it works as you say.. Since I am a novice in
SQL, i do not the size it displays.. will you please
explain about the size , for instance line below is one of
the largest table in my database
[dbo].[SoftwareFile] 6175326 355529.66
If the last number is in MB then its size is 355 Gig which
would be incorrect as my whole harddisk size itself is
300Gig and the whole database holding it is 70 Gig
Arun
quote:

>--Original Message--
>Try this:
>http://vyaskn.tripod.com/sp_show_biggest_tables.htm
>--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>Is .NET important for a database professional?
>http://vyaskn.tripod.com/poll.htm
>
>
>"Arun" <anonymous@.discussions.microsoft.com> wrote in

message
quote:

>news:066901c3d959$d9e77fd0$a301280a@.phx.gbl...
>Is there any SP or a function to enumerate all the tables
>for their size for a given database... ?
>Thanks
>Arun
>
>.
>

enumerating all tables for size

Is there any SP or a function to enumerate all the tables
for their size for a given database... ?
Thanks
ArunTry this:
http://vyaskn.tripod.com/sp_show_biggest_tables.htm
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Arun" <anonymous@.discussions.microsoft.com> wrote in message
news:066901c3d959$d9e77fd0$a301280a@.phx.gbl...
Is there any SP or a function to enumerate all the tables
for their size for a given database... ?
Thanks
Arun|||Vyas,
thanks and it works as you say.. Since I am a novice in
SQL, i do not the size it displays.. will you please
explain about the size , for instance line below is one of
the largest table in my database
[dbo].[SoftwareFile] 6175326 355529.66
If the last number is in MB then its size is 355 Gig which
would be incorrect as my whole harddisk size itself is
300Gig and the whole database holding it is 70 Gig
Arun
>--Original Message--
>Try this:
>http://vyaskn.tripod.com/sp_show_biggest_tables.htm
>--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>Is .NET important for a database professional?
>http://vyaskn.tripod.com/poll.htm
>
>
>"Arun" <anonymous@.discussions.microsoft.com> wrote in
message
>news:066901c3d959$d9e77fd0$a301280a@.phx.gbl...
>Is there any SP or a function to enumerate all the tables
>for their size for a given database... ?
>Thanks
>Arun
>
>.
>|||Run the following and see what it says:
EXEC sp_spaceused 'SoftwareFile'
If that reports the same size, then your sysindexes table is not accurate,
and you will have to run DBCC UPDATEUSAGE to fix that.
Look up SQL Server Books Online for more information on DBCC UPDATEUSAGE.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
Is .NET important for a database professional?
http://vyaskn.tripod.com/poll.htm
"Arun" <anonymous@.discussions.microsoft.com> wrote in message
news:0af201c3d9eb$284ef130$a501280a@.phx.gbl...
Vyas,
thanks and it works as you say.. Since I am a novice in
SQL, i do not the size it displays.. will you please
explain about the size , for instance line below is one of
the largest table in my database
[dbo].[SoftwareFile] 6175326 355529.66
If the last number is in MB then its size is 355 Gig which
would be incorrect as my whole harddisk size itself is
300Gig and the whole database holding it is 70 Gig
Arun
>--Original Message--
>Try this:
>http://vyaskn.tripod.com/sp_show_biggest_tables.htm
>--
>HTH,
>Vyas, MVP (SQL Server)
>http://vyaskn.tripod.com/
>Is .NET important for a database professional?
>http://vyaskn.tripod.com/poll.htm
>
>
>"Arun" <anonymous@.discussions.microsoft.com> wrote in
message
>news:066901c3d959$d9e77fd0$a301280a@.phx.gbl...
>Is there any SP or a function to enumerate all the tables
>for their size for a given database... ?
>Thanks
>Arun
>
>.
>

Tuesday, March 27, 2012

Enumerate/list data sources and their connection strings

I was wondering ..
Is there an easy way to enumerate all data sources and their configuration
parameters (e.g. connection strings) in a reporting services database ?
Thanks a bunch.Isn't there really anybody here on the forum with a suggestion how to
achieve this or is it actually so trivial that I don't deserve a reply ;) ?

Enumerate Users in NT Groups

Hi,
How Can I list the users in an NT group, ie I have user Joe Bloggs who is
in NT Group Domain/Users.
I need to return to a client app what group they are in.
Julian
Julian
Look at sp_helpusers and also
DECLARE @.cmd VARCHAR(100)
SET @.cmd = 'NET USER "' + yourloginname+ '"'
EXEC master.dbo.xp_cmdshell @.cmd
"Julian" <Jpotter730@.msn.com> wrote in message
news:#GH7q9cLEHA.1484@.tk2msftngp13.phx.gbl...
> Hi,
> How Can I list the users in an NT group, ie I have user Joe Bloggs who
is
> in NT Group Domain/Users.
> I need to return to a client app what group they are in.
> Julian
>
|||Hi,
Run the below command from command prompt to list the users inside a group.
net group groupname
and for local groups run the below command
net localgroup groupname
Note: From Query analyzer as Uri mentioned you can use xp_cmdshell to
execute the above commands.
Thanks
Hari
MCDBA
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ep7KNCdLEHA.3472@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Julian
> Look at sp_helpusers and also
> DECLARE @.cmd VARCHAR(100)
> SET @.cmd = 'NET USER "' + yourloginname+ '"'
> EXEC master.dbo.xp_cmdshell @.cmd
> "Julian" <Jpotter730@.msn.com> wrote in message
> news:#GH7q9cLEHA.1484@.tk2msftngp13.phx.gbl...
who
> is
>
sql

Enumerate Users in NT Groups

Hi,
How Can I list the users in an NT group, ie I have user Joe Bloggs who is
in NT Group Domain/Users.
I need to return to a client app what group they are in.
JulianJulian
Look at sp_helpusers and also
DECLARE @.cmd VARCHAR(100)
SET @.cmd = 'NET USER "' + yourloginname+ '"'
EXEC master.dbo.xp_cmdshell @.cmd
"Julian" <Jpotter730@.msn.com> wrote in message
news:#GH7q9cLEHA.1484@.tk2msftngp13.phx.gbl...
> Hi,
> How Can I list the users in an NT group, ie I have user Joe Bloggs who
is
> in NT Group Domain/Users.
> I need to return to a client app what group they are in.
> Julian
>|||Hi,
Run the below command from command prompt to list the users inside a group.
net group groupname
and for local groups run the below command
net localgroup groupname
Note: From Query analyzer as Uri mentioned you can use xp_cmdshell to
execute the above commands.
Thanks
Hari
MCDBA
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ep7KNCdLEHA.3472@.TK2MSFTNGP09.phx.gbl...
> Julian
> Look at sp_helpusers and also
> DECLARE @.cmd VARCHAR(100)
> SET @.cmd = 'NET USER "' + yourloginname+ '"'
> EXEC master.dbo.xp_cmdshell @.cmd
> "Julian" <Jpotter730@.msn.com> wrote in message
> news:#GH7q9cLEHA.1484@.tk2msftngp13.phx.gbl...
who[vbcol=seagreen]
> is
>

Enumerate Users in NT Groups

Hi,
How Can I list the users in an NT group, ie I have user Joe Bloggs who is
in NT Group Domain/Users.
I need to return to a client app what group they are in.
JulianJulian
Look at sp_helpusers and also
DECLARE @.cmd VARCHAR(100)
SET @.cmd = 'NET USER "' + yourloginname+ '"'
EXEC master.dbo.xp_cmdshell @.cmd
"Julian" <Jpotter730@.msn.com> wrote in message
news:#GH7q9cLEHA.1484@.tk2msftngp13.phx.gbl...
> Hi,
> How Can I list the users in an NT group, ie I have user Joe Bloggs who
is
> in NT Group Domain/Users.
> I need to return to a client app what group they are in.
> Julian
>|||Hi,
Run the below command from command prompt to list the users inside a group.
net group groupname
and for local groups run the below command
net localgroup groupname
Note: From Query analyzer as Uri mentioned you can use xp_cmdshell to
execute the above commands.
Thanks
Hari
MCDBA
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:ep7KNCdLEHA.3472@.TK2MSFTNGP09.phx.gbl...
> Julian
> Look at sp_helpusers and also
> DECLARE @.cmd VARCHAR(100)
> SET @.cmd = 'NET USER "' + yourloginname+ '"'
> EXEC master.dbo.xp_cmdshell @.cmd
> "Julian" <Jpotter730@.msn.com> wrote in message
> news:#GH7q9cLEHA.1484@.tk2msftngp13.phx.gbl...
> > Hi,
> >
> > How Can I list the users in an NT group, ie I have user Joe Bloggs
who
> is
> > in NT Group Domain/Users.
> >
> > I need to return to a client app what group they are in.
> >
> > Julian
> >
> >
>

enumerate the rows of the xml

It is possible to enumerate the rows of the xml in a consultation?
For example:
select cast(tb01_XML as xml)
from Table01 as USU
where ID = 1
for xml raw(''), elements, type
<CAR xmlns="Hello" Name="Ricardo" />
<CAR xmlns="Hello" Name="Ricardo" />
-->
<CAR xmlns="Hello" Num="1" Name="Ricardo" />
<CAR xmlns="Hello" Num="2" Name="Ricardo" />
thank for any help
How exactly does your data look like?
You could use the ROW_NUMBER() function to add an enumeration...
Best regards
Michael
"sqlextreme" <sqlextreme@.discussions.microsoft.com> wrote in message
news:ABFC1DCD-1D33-4DBE-A606-68985452DE31@.microsoft.com...
> It is possible to enumerate the rows of the xml in a consultation?
> For example:
> select cast(tb01_XML as xml)
> from Table01 as USU
> where ID = 1
> for xml raw(''), elements, type
> <CAR xmlns="Hello" Name="Ricardo" />
> <CAR xmlns="Hello" Name="Ricardo" />
> -->
> <CAR xmlns="Hello" Num="1" Name="Ricardo" />
> <CAR xmlns="Hello" Num="2" Name="Ricardo" />
> thank for any help
>

enumerate the rows of the xml

It is possible to enumerate the rows of the xml in a consultation?
For example:
select cast(tb01_XML as xml)
from Table01 as USU
where ID = 1
for xml raw(''), elements, type
<CAR xmlns="Hello" Name="Ricardo" />
<CAR xmlns="Hello" Name="Ricardo" />
-->
<CAR xmlns="Hello" Num="1" Name="Ricardo" />
<CAR xmlns="Hello" Num="2" Name="Ricardo" />
thank for any helpHow exactly does your data look like?
You could use the ROW_NUMBER() function to add an enumeration...
Best regards
Michael
"sqlextreme" <sqlextreme@.discussions.microsoft.com> wrote in message
news:ABFC1DCD-1D33-4DBE-A606-68985452DE31@.microsoft.com...
> It is possible to enumerate the rows of the xml in a consultation?
> For example:
> select cast(tb01_XML as xml)
> from Table01 as USU
> where ID = 1
> for xml raw(''), elements, type
> <CAR xmlns="Hello" Name="Ricardo" />
> <CAR xmlns="Hello" Name="Ricardo" />
> -->
> <CAR xmlns="Hello" Num="1" Name="Ricardo" />
> <CAR xmlns="Hello" Num="2" Name="Ricardo" />
> thank for any help
>sql

enumerate the list of MSDE instances

Hi All,
I want to enumerate the list of MSDE instances on LAN using VB6.I
cannot use SQLDMO or SMO library.
I am using NetServerEnum API but it displays only SQL servers and
default MSDE instance.
Is there any API or other means to get the list of named instance of
MSDE in VB6.
Please advice.
Nidhi Sharma
Thanks for your response!
SuperSockets Network Protocols were enabled during installation of
MSDE2000.
I am able to connect successfully using <Computer Name>/
<InstanceName>. But the problem is that i am unable to get the list of
MSDE instances on the LAN.It displays the default instance if present.
Could you guide me how to broadcast UDP on port 1434 in VB6?
Nidhi Sharma

enumerate suffixes and counts in varchar column

I have a column of VARCHAR values for which each value may contain one of
more dashes ("-" character). I would like T-SQL that enumerate all the
possible values following the FINAL dash character and counts the number of
occurrances of each and loads these into another table (2 col table :
Suffix[nvarchar] and Count[int])First, the obligitory note of reason. Storing data like this is generally a
bad idea. If you need to use substring on a value then it probably needs to
be > 1 columns. Maybe not in your case, but I figure that the dashes aren't
a random pattern, right?
Second, this will give you the result, I think...
create table test
(
value varchar(20)
)
insert into test
select 'hds-f-dsafsaf-asf'
union all
select 'asdfasdfads'
union all
select 'asdfads-asdfas-as'
union all
select 'isd-asd'
go
select case when charindex('-',value) > 0 then
substring(reverse(value),1,charindex('-',reverse(value))-1)
else ''
end
from test
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:Oxjgp2QLGHA.904@.TK2MSFTNGP10.phx.gbl...
>I have a column of VARCHAR values for which each value may contain one of
>more dashes ("-" character). I would like T-SQL that enumerate all the
>possible values following the FINAL dash character and counts the number of
>occurrances of each and loads these into another table (2 col table :
>Suffix[nvarchar] and Count[int])
>|||Yes, I agree. Very bad data structure. Not my idea.
You're code looks interesting, but I also need a count of each distinct
suffix (where a distinct suffix is defined as one that follows the final
dash ("-") character.
"Louis Davidson" <dr_dontspamme_sql@.hotmail.com> wrote in message
news:%23hLtR%23QLGHA.2416@.TK2MSFTNGP15.phx.gbl...
> First, the obligitory note of reason. Storing data like this is generally
> a bad idea. If you need to use substring on a value then it probably
> needs to be > 1 columns. Maybe not in your case, but I figure that the
> dashes aren't a random pattern, right?
> Second, this will give you the result, I think...
> create table test
> (
> value varchar(20)
> )
> insert into test
> select 'hds-f-dsafsaf-asf'
> union all
> select 'asdfasdfads'
> union all
> select 'asdfads-asdfas-as'
> union all
> select 'isd-asd'
> go
> select case when charindex('-',value) > 0 then
> substring(reverse(value),1,charindex('-',reverse(value))-1)
> else ''
> end
> from test
>
> --
> ----
--
> Louis Davidson - http://spaces.msn.com/members/drsql/
> SQL Server MVP
> "Arguments are to be avoided: they are always vulgar and often
> convincing."
> (Oscar Wilde)
> "John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
> news:Oxjgp2QLGHA.904@.TK2MSFTNGP10.phx.gbl...
>|||Here is the complete solution. Hope this helps get you going...
create table test
(
value varchar(20)
)
insert into test
select 'hds-f-dsafsaf-asf'
union all
select 'asdfasdfads'
union all
select 'asdfads-asdfas-as'
union all
select 'isd-asd'
union all
select 'isd3-asdfa-asd'
go
select suffix, count(*)
from ( select reverse(case when charindex('-',value) > 0 then
substring(reverse(value),1,charindex('-',reverse(value))-1)
else ''
end) as suffix
from test ) as suffixValues
group by suffix
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"John A Grandy" <johnagrandy-at-yahoo-dot-com> wrote in message
news:uhJPFDRLGHA.2668@.tk2msftngp13.phx.gbl...
> Yes, I agree. Very bad data structure. Not my idea.
> You're code looks interesting, but I also need a count of each distinct
> suffix (where a distinct suffix is defined as one that follows the final
> dash ("-") character.
>
> "Louis Davidson" <dr_dontspamme_sql@.hotmail.com> wrote in message
> news:%23hLtR%23QLGHA.2416@.TK2MSFTNGP15.phx.gbl...
>

Enumerate Subscriptions in a Merge Replicated CE Database?

How can I list all of the Subscriptions in a CE Database that was created with the .Net System.Data.SqlServerCe.SqlCeReplication.AddSubscription method?

After I create the CE database in an sdf file, I can connect to it with SQL Servr Mgmt Studio, then see the list of Subscriptions in the Object TreeView, under "Replication"

But I can't find that Subscription list in any properties or methods of System.Data.SqlServerCe.SqlCeReplication or System.Data.SqlServerCe.SqlCeConnection

Should I be looking in RMO features like Microsoft.SqlServer.Replication?

We want to confirm that a local CE database was last synced from the expected SQL Server database by checking the Publisher property of each subscription in the CE database.

Thanks

There are a number of system tables available with all the required information, see http://blogs.msdn.com/sqlservercompact/archive/2007/02/19/howto-detect-the-database-is-merge-replicated.aspx|||

Thanks.

Relational database systems keep their data in relational tables - even SQL Server CE!

Select*from __sysMergeSubscriptions

;Select*from __sysMergeArticles

Enumerate SQL servers?

I'm working on an Access app that will have a SQL 2K backend. My setup will
install MSDE, and I will set the sa password, etc. which I don't want the
end user's to know. My problem is in Relinking the ODBC tables once it is
installed in the field. The one item I won't know is the name of the server
MSDE is installed on. I want to prompt the user to pick the server from a
list, much like you do when creating a DSN through the ODBC Administrator. I
can't use the ODBC Administrator to create a DSN because if the user doesn't
enter the sa password, it fails; also, I want to use DSN-less connections.
But I can't seem to find an API call to enumerate the SQL servers available
on the network. Does anyone know of an API to call? Alternatively, some code
to enumerate SQL servers running on the LAN? TIA!Can also look at :
http://www.extremeexperts.com/sql/f...istServers.aspx
HTH,
Vinod Kumar
MCSE, DBA, MCAD, MCSD
http://www.extremeexperts.com
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
"Ron Hinds" <__NoSpam@.__NoSpamramac.com> wrote in message
news:%23rKHj4H3DHA.1392@.TK2MSFTNGP11.phx.gbl...
quote:

> I'm working on an Access app that will have a SQL 2K backend. My setup

will
quote:

> install MSDE, and I will set the sa password, etc. which I don't want the
> end user's to know. My problem is in Relinking the ODBC tables once it is
> installed in the field. The one item I won't know is the name of the

server
quote:

> MSDE is installed on. I want to prompt the user to pick the server from a
> list, much like you do when creating a DSN through the ODBC Administrator.

I
quote:

> can't use the ODBC Administrator to create a DSN because if the user

doesn't
quote:

> enter the sa password, it fails; also, I want to use DSN-less connections.
> But I can't seem to find an API call to enumerate the SQL servers

available
quote:

> on the network. Does anyone know of an API to call? Alternatively, some

code
quote:

> to enumerate SQL servers running on the LAN? TIA!
>
|||Hi Vinodk,
I can list SQL server instances on my personal computer fairly easily using
SQLBrowseConnect and associated methods but I have trouble trying to
enumerate all SQL servers on the network if I am not connected to a browser
service. Obviously, I don't expect to get a list of servers if I am not
connected but I can't seem to get a *faster* way to check if I am connected
to the browser service.
I use something like the folowing to see if any master browsers are
available in hopes for speed bit it is very slow. If the status return
ERROR_NO_BROWSER_SERVERS_FOUND, I don't want to go further.
nStatus = NetServerEnum(NULL,
(DWORD)100,
(LPBYTE *) &pBufServerBrowser,
dwPrefMaxLen,
&dwEntriesRead,
&dwTotalEntries,
SV_TYPE_DOMAIN_MASTER |
SV_TYPE_POTENTIAL_BROWSER |
SV_TYPE_BACKUP_BROWSER |
SV_TYPE_MASTER_BROWSER,
NULL,
&dwResumeHandle);
Any thoughts on this'
Thanks in advance for any help...
Regards,
Chris H
"Vinodk" <vinodk_sct@.NO_SPAM_hotmail.com> wrote in message
news:eXEf9iL3DHA.2296@.TK2MSFTNGP11.phx.gbl...
> Can also look at :
> http://www.extremeexperts.com/sql/f...istServers.aspx
> --
> HTH,
> Vinod Kumar
> MCSE, DBA, MCAD, MCSD
> http://www.extremeexperts.com
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techin.../2000/books.asp
>
> "Ron Hinds" <__NoSpam@.__NoSpamramac.com> wrote in message
> news:%23rKHj4H3DHA.1392@.TK2MSFTNGP11.phx.gbl...
> will
the
is
> server
a
Administrator.
> I
> doesn't
connections.
> available
> code
>

Enumerate SQL Server Logins and Permissions

Haven't been able to find the answer to this after sever searches. So decided to open the thread myself.

I am trying to write a report enumerating logins in SQL Server and all database-level and object-level permissions granted to each login.

Can someone tell me what system objects I can query to fetch this information?

TIA.

Hi,

You can get the results by querying the following system views(cata log views):

Database-Level Views:


sys.database_permissions
sys.database_principals

Server-Level Views:


sys.server_permissions
sys.sql_logins
sys.server_principals

Thanks & Regards,

Kiran.Y

|||

That's just what I was looking for. Thanks much.

sql

Enumerate SQL server list?

Anyone know how to enumerate the SQL Servers on a network using .Net? I can
do this with VB6, but howso in .Net?
Hi Earl,
One way would be:
Q287737
http://support.microsoft.com/default...EN-US;Q287737&
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com
"Earl comcast net>" <brikshoe<at.> wrote in message
news:%23YXdcy5FEHA.2208@.TK2MSFTNGP09.phx.gbl...
> Anyone know how to enumerate the SQL Servers on a network using .Net? I
can
> do this with VB6, but howso in .Net?
>
|||I haven't seen how to do it using the .Net Framework, but if the method you use for VB6 provides a COM object interface, you can include a reference to the library in your project. .Net will create the classes required for the mashalling between the manag
ed and unmanaged code.
|||Earl,
This is worth looking at to give you some ideas. It's not .net though.
http://sqldev.net/misc/ListSQLSvr.htm
Mark Allison, SQL Server MVP
http://www.markallison.co.uk
|||Hi Mika,
This is essentially the same thing I'm doing now in VB6, but I was looking
to see if there was another way to not use a COM reference in order to do
this with .Net. Maybe this is the wrong way of looking at this -- what am I
giving up using COM here? Incidentally, I've been on that RightHand site in
the past, good stuff you folks are building over there.
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OyYPu47FEHA.3188@.TK2MSFTNGP10.phx.gbl...
> Hi Earl,
> One way would be:
> Q287737
> http://support.microsoft.com/default...EN-US;Q287737&
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & software development
> miha at rthand com
> www.rthand.com
> "Earl comcast net>" <brikshoe<at.> wrote in message
> news:%23YXdcy5FEHA.2208@.TK2MSFTNGP09.phx.gbl...
> can
>
|||Miha,
Using this VB6 method, I get an invalid cast exception when I try to create
an object for the namelist (Dim oNames As SQLDMO.NameList). Even with a
Try-Catch, I still get the exception: "Query Interface for interface
SQLDMO.Namelist failed." Is this a COM wrapper issue?
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message
news:OyYPu47FEHA.3188@.TK2MSFTNGP10.phx.gbl...
> Hi Earl,
> One way would be:
> Q287737
> http://support.microsoft.com/default...EN-US;Q287737&
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & software development
> miha at rthand com
> www.rthand.com
> "Earl comcast net>" <brikshoe<at.> wrote in message
> news:%23YXdcy5FEHA.2208@.TK2MSFTNGP09.phx.gbl...
> can
>
|||Hehe, thanks Mark... I've read this and every article I could find on the
web about this topic and they all pertain to VB6. Gets me close though.
"Mark Allison" <marka@.no.tinned.meat.mvps.org> wrote in message
news:814797B0-7FBF-4D8A-8ABA-0CB3B8EBCE08@.microsoft.com...
> Earl,
> This is worth looking at to give you some ideas. It's not .net though.
> http://sqldev.net/misc/ListSQLSvr.htm
> --
> Mark Allison, SQL Server MVP
> http://www.markallison.co.uk
|||Thanks Al, the problem I'm having is that apparently one of the classes is
not being created because I get an error trying to assign the list object to
the name object.
Dim oSQLNames As SQLDMO.NameList
Dim oSQLApp As SQLDMO.Application
oSQLApp = New SQLDMO.Application
'getting invalid cast error on this assignment
oSQLNames = oSQLApp.ListAvailableSQLServers
"Al" <al_davie@.hotmail.com> wrote in message
news:A7B8DA42-0D39-4529-B2AE-9C8DAED59F1B@.microsoft.com...
> I haven't seen how to do it using the .Net Framework, but if the method
you use for VB6 provides a COM object interface, you can include a reference
to the library in your project. .Net will create the classes required for
the mashalling between the managed and unmanaged code.
|||Hi,
I've just tried your code fragment, and I don't get a problem.
Are you getting the problem in the debugger or deployed ?
Here are the facts for my set-up :-
VS 2003 / Framework 1.1
SQL Server 2000 SP3 (not Sp3a)
Windows 2000Pro SP4
Running via debugger, so not deployed.
Visual Basic Windows application
Option Explicit ON
Option Strict OFF
Option Compare Binary
The Imports and References are all the defaults for a Windows Application, excepted added the SQLDMO Object lib version 8.0
Let me know how you get on
|||If you're getting stuck, send me the source.
Email my Hotmail account, i'll send you my main email address.