|
I wasn't aware that XML files were physical.
What you are trying to do depends on the schema. Can you show an example?
|
|
|
|
|
Member 4006546 wrote: How to convert Physical XML files into Sqlserver Tables?
..documentation[^].
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
How do you use the AVG api in sql to manage grouped output? For example:
Given a SQL Table “Employee”
Name Salary City
John Doe 15000 Seattle
Jane Doe 30000 Redmond
Tim Wayne 25000 Seattle
Write a SQL query that would return the average salary per city in the format shown below:
City Salary
Seattle 20000
Redmond 30000
|
|
|
|
|
Xarzu wrote: Write a SQL query that would return the average salary per city in the format shown below:
For some reason this sounds like homework. What have you done so far for a query?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Select City, AVG(Salary) from Employee where ... I don't know the rest
Where city == city or something like that?
|
|
|
|
|
You could try:
select city, avg(salary) from Employee group by city
This will give you the average grouped by cities. How to sort the cities in the order you want to order by in your expected result, I'm leaving that as an exercise
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
modified 11-Aug-12 20:19pm.
|
|
|
|
|
Xarzu wrote: How do you use the AVG api function in sql
It's not an "API".
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
All Version of Sql server
Select City, AVG(Salary) AS Salary
FROM @t
Group By City
Order By City DESC
This can also be done by treating AVG function as Analytical function which is available since SQL Server 2005
Select City,Salary From
(
Select
Rn = Row_Number() Over(PARTITION BY City Order By (Select 1))
,City
,AVG(Salary) OVER(PARTITION BY City) AS Salary
From @t) X
Where X.Rn = 1
Order By City DESC
The answer for both the cases
City Salary
Seattle 20000
Redmond 30000
Niladri Biswas
(Code Project MVP 2012)
|
|
|
|
|
I have a question that's more of the hypothetical kind.
I have two tables:
Usersuserid | username |
---|
1 | John Doe | 2 | Jane Doe |
emailuserid | email |
---|
1 | john.doe@myworkmail.com | 1 | john.doe@myprivatemail.net | 1 | john.doe@someothermail.org | 2 | jane.doe@myworkmail.com | 2 | jane.doe@myprivatemail.net | 2 | jane.doe@someothermail.org |
Now I'd like to make one (or zero) email address per user the default address.
On an ANSI compliant system I could simply add a nullable column to the email table and add a check so that the value can only be 'DEFAULT' or null and add a unique composite key on this column and the userid column.
This would of course not work on certain databases that don't allow more than one null value when having a unique key.
So what other solutions are there? Preferrably not allowing null values.
|
|
|
|
|
How about a bit field (0/1;true/false)? Set the default to 0, not null.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
How would that allow only one emailaddress to be set to default?
|
|
|
|
|
The default is set to true, the rest to false.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
An extra table to store only a reference to the user, and a reference to his default email;
..which would work best if email would get an identity-like field.
--edit;
Add a UNIQUE constraint on the userId-column
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Where's the 'slapping my forehead' icon when I need it? I guess will have to do.
|
|
|
|
|
Hi all,I want to write an application(web or desktop) which will monitor different database status(status:conncetion error,running or down e.t.c) and report back to say:database1 is not down, oracle database2 is down or connection error etc. So I dont really have an idea where to start.Coding using C#.thanx.
|
|
|
|
|
You could begin by something as simple as:
1) Make a connection to the database New SqlConnection(GetConnString())
2) Open the connection SQLconn.Open()
3) Issue some sort of simple command SQLcmd = New SqlCommand("select count(*) from customers", SQLconn)
4) Get data from the DB r = SQLcmd.ExecuteScalar
5) Wrap all of this code in a Try-Catch block and if successful, then you can safely assume that your connection to the database is up and the database is running.
Good luck
|
|
|
|
|
Thanx a lot.I even add more functionalities/Methods
|
|
|
|
|
leketekoa wrote: oracle database2 is
Did you start by looking for existing solutions?
As an example you might want to start with the following in google: nagios oracle
leketekoa wrote: nd report back
What that means can add significantly to scope of the project.
|
|
|
|
|
I have a client that was using Q&A until the old computer died yesterday. He has backups of the data base, but not the program itself and Symantec has not supported Q&A for a long time.
Can anyone point me to a low cost (or free) conversion utility to read these files?
Or a copy of Q&A that I can use long enough to convert them to fixed ascii?
I did find Sesame, which seems to have taken over Q&A, but they want $350 for the program - which is a lot to pay for a few file conversions.
I also found conversion services, but again a lot of money.
Any help appreciated!
|
|
|
|
|
snowman53 wrote: I did find Sesame, which seems to have taken over Q&A, but they want $350 for the program
Also found an online-converting service, but they'll be asking money too. If the data is worth more than those $350, go for it - and explain the concept of backups and/or a vendor lock-in.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
They haven't updated their software since the mid 90's and are upset I can't re-install Q&A without the original copies!
|
|
|
|
|
snowman53 wrote: are upset I can't re-install Q&A without the original copies!
Not very rational, is it? It'd be hard for anyone to install a copy without an installer
Without that copy there's not much you can do, except trying one of the expensive converters. Perhaps your client could take the time and look for a second-hand version?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I know nothing about Q&A but a lot of the 90s databases were based around DBase formats and there was a whole family of drivers for reading various dbase files. The most comprehensive was DBase IV and the foxpro drivers.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for the good suggestion - after I read it I tried both formats, but to no avail.
Thanks again.
|
|
|
|
|
I need to secure only one particular database in SQL Server so I could access it only with certain predefined username/password. So, I am login in SQL Server as windows authenticated or sa and see all databases with details, but, for one database I want to see her in list but cannot access further without user/pass.
|
|
|
|