Showing posts with label helphow. Show all posts
Showing posts with label helphow. Show all posts

Saturday, February 25, 2012

Please help...how to automatically generate names in the table?

Hello! every one, I am a student studying DB Admin and my professor gave us an assignment which I couldn' t quite get it. Could any one offer a hand?

the assignment is to generate random number with random name(female or male) the names are all from an imported table(such as one from Northwind).

He said first step was to decide on sex, then get the "count" of names, and then decide on ranmdom number between 1 and the count....

any way I am really confused and couldn't know how to start it.please help!

If your intention is to fetch the random name from the given table the followint query will do..

Code Snippet

Declare @.Sex as Varchar(10);

Set @.Sex='M'

Select Top 1 FirstName + ', ' + LastNamefrom Employees Where Sex=@.Sex Order By newid()

Monday, February 20, 2012

Please Help!How to get directories list for remote machine?

Hello,
We are developing appl. Backup/Restore database using SQLServerAgent.
In my appl. I want to do the same as in the SQL Enterprise(2000),
when I select server for backup, Enterprise display brower list (hard
disks>dir...) for selected machine.
How I can get the browser(Hards>dirs) for selected machine?
Thanks in advance,
Pola
Pola
How does your question relate to SQL Server? Perhaps some controls provided
with .NET technology may help you.
"Pola" <Pola@.discussions.microsoft.com> wrote in message
news:05C7D6B8-E7A0-4545-90E2-4B4B36C87663@.microsoft.com...
> Hello,
> We are developing appl. Backup/Restore database using SQLServerAgent.
> In my appl. I want to do the same as in the SQL Enterprise(2000),
> when I select server for backup, Enterprise display brower list (hard
> disks>dir...) for selected machine.
> How I can get the browser(Hards>dirs) for selected machine?
> Thanks in advance,
> Pola
>
|||Rather than using SQL Server, I suggest you consider WMI queries to
enumerate remote resources. C# example:
//System.Management rreference required
ObjectQuery localDiskQuery =
new ObjectQuery("SELECT Name FROM Win32_LogicalDisk WHERE DriveType =
3");
using (ManagementObjectSearcher searcher =
new ManagementObjectSearcher(localDiskQuery))
{
searcher.Scope =
new ManagementScope(string.Format(@."//{0}/root/cimv2",
ServerName));
foreach (ManagementObject logicalDisk in searcher.Get())
{
Console.WriteLine(WriteLine(logicalDisk["Name"].ToString());
}
}
Hope this helps.
Dan Guzman
SQL Server MVP
"Pola" <Pola@.discussions.microsoft.com> wrote in message
news:05C7D6B8-E7A0-4545-90E2-4B4B36C87663@.microsoft.com...
> Hello,
> We are developing appl. Backup/Restore database using SQLServerAgent.
> In my appl. I want to do the same as in the SQL Enterprise(2000),
> when I select server for backup, Enterprise display brower list (hard
> disks>dir...) for selected machine.
> How I can get the browser(Hards>dirs) for selected machine?
> Thanks in advance,
> Pola
>

Please Help!How to get directories list for remote machine?

Hello,
We are developing appl. Backup/Restore database using SQLServerAgent.
In my appl. I want to do the same as in the SQL Enterprise(2000),
when I select server for backup, Enterprise display brower list (hard
disks>dir...) for selected machine.
How I can get the browser(Hards>dirs) for selected machine?
Thanks in advance,
PolaPola
How does your question relate to SQL Server? Perhaps some controls provided
with .NET technology may help you.
"Pola" <Pola@.discussions.microsoft.com> wrote in message
news:05C7D6B8-E7A0-4545-90E2-4B4B36C87663@.microsoft.com...
> Hello,
> We are developing appl. Backup/Restore database using SQLServerAgent.
> In my appl. I want to do the same as in the SQL Enterprise(2000),
> when I select server for backup, Enterprise display brower list (hard
> disks>dir...) for selected machine.
> How I can get the browser(Hards>dirs) for selected machine?
> Thanks in advance,
> Pola
>|||Rather than using SQL Server, I suggest you consider WMI queries to
enumerate remote resources. C# example:
//System.Management rreference required
ObjectQuery localDiskQuery =
new ObjectQuery("SELECT Name FROM Win32_LogicalDisk WHERE DriveType =
3");
using (ManagementObjectSearcher searcher =
new ManagementObjectSearcher(localDiskQuery)
)
{
searcher.Scope =
new ManagementScope(string.Format(@."//{0}/root/cimv2",
ServerName));
foreach (ManagementObject logicalDisk in searcher.Get())
{
Console.WriteLine(WriteLine(logicalDisk["Name"].ToString());
}
}
Hope this helps.
Dan Guzman
SQL Server MVP
"Pola" <Pola@.discussions.microsoft.com> wrote in message
news:05C7D6B8-E7A0-4545-90E2-4B4B36C87663@.microsoft.com...
> Hello,
> We are developing appl. Backup/Restore database using SQLServerAgent.
> In my appl. I want to do the same as in the SQL Enterprise(2000),
> when I select server for backup, Enterprise display brower list (hard
> disks>dir...) for selected machine.
> How I can get the browser(Hards>dirs) for selected machine?
> Thanks in advance,
> Pola
>

Please Help!How to get directories list for remote machine?

Hello,
We are developing appl. Backup/Restore database using SQLServerAgent.
In my appl. I want to do the same as in the SQL Enterprise(2000),
when I select server for backup, Enterprise display brower list (hard
disks>dir...) for selected machine.
How I can get the browser(Hards>dirs) for selected machine?
Thanks in advance,
PolaPola
How does your question relate to SQL Server? Perhaps some controls provided
with .NET technology may help you.
"Pola" <Pola@.discussions.microsoft.com> wrote in message
news:05C7D6B8-E7A0-4545-90E2-4B4B36C87663@.microsoft.com...
> Hello,
> We are developing appl. Backup/Restore database using SQLServerAgent.
> In my appl. I want to do the same as in the SQL Enterprise(2000),
> when I select server for backup, Enterprise display brower list (hard
> disks>dir...) for selected machine.
> How I can get the browser(Hards>dirs) for selected machine?
> Thanks in advance,
> Pola
>|||Rather than using SQL Server, I suggest you consider WMI queries to
enumerate remote resources. C# example:
//System.Management rreference required
ObjectQuery localDiskQuery = new ObjectQuery("SELECT Name FROM Win32_LogicalDisk WHERE DriveType =3");
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(localDiskQuery))
{
searcher.Scope = new ManagementScope(string.Format(@."//{0}/root/cimv2",
ServerName));
foreach (ManagementObject logicalDisk in searcher.Get())
{
Console.WriteLine(WriteLine(logicalDisk["Name"].ToString());
}
}
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Pola" <Pola@.discussions.microsoft.com> wrote in message
news:05C7D6B8-E7A0-4545-90E2-4B4B36C87663@.microsoft.com...
> Hello,
> We are developing appl. Backup/Restore database using SQLServerAgent.
> In my appl. I want to do the same as in the SQL Enterprise(2000),
> when I select server for backup, Enterprise display brower list (hard
> disks>dir...) for selected machine.
> How I can get the browser(Hards>dirs) for selected machine?
> Thanks in advance,
> Pola
>