Hi
Based on the following table
Path
----------------------
area1
area1\area2
area1\area2\area3
area1\area2\area3\area4
area1\area2\area5
area1\area2\area6
area1\area7
Input to my stored procedure is areapath and no.of children (indicates the depth that needs to considered from the input areapath)
areapath=area1
children=2
Above sh...
It occurs to me that if you have fields dependent on each other in an update statement, I'm not sure that one can guarantee the ordering (or that one needs to!).
As an example, say you had the following Update:
UPDATE Table
SET NewValue = OldValue, OldValue = NULL
Would NewValue always update first, then OldValue be nullified? Or is...
INSERT INTO MISSION_OBJECTIVE( MSN_INT_ID, MO_INT_ID, MO_MSN_CLASS_NM,
MO_MSN_CLASS_CD, MO_MSN_TYPE, MO_PRIORITY, MO_COMMENT, MO_START_DT,
MO_END_DT, ASP_AIRSPACE_NM, MO_OBJ_LOCATION, MO_ALO_LEG_ID,
MO_ALO_ARRIVE_LOC) SELECT '1025', '1', 'AIRDROP', 'ADP', 'LAPES', NULL,
COALESCE( NULL, ' '), TO_TIMESTAMP( '1002260900', 'YYMMDDHH24MI'),
T...
Hi
For the below data (well..there are many more nodes in the team foundation server table which i need to refer to..below is just a sample)
Nodes
------------------------
\node1\node2\node3\
\node1\node2\node5\
\node1\node2\node3\node4\
\node1\node2\node3\node4\node5\
I was wondering if i can apply something like (below query does n...
Hi, I have the following Table definition with sample data. In the following table, Customer Product & Date are key fields
Table One
Customer Product Date SALE
X A 01/01/2010 YES
X A 02/01/2010 YES
X A 03/01/2010 NO
X A 04/01/2010 NO
X ...
I have a tblMachineReports with the columns: Status(varchar),LogDate(datetime),Category(varchar), and MachineID(int).
I want to retrieve the latest status update from each category for every machine, so in effect getting a snapshot of the latest statuses of all the machines unique to their MachineID.
The table data would look like
Cat...
I need to write a SQL-Server query but I don't know how to solve. I have a table RealtimeData with data:
Time | Value
4/29/2009 12:00:00 AM | 3672.0000
4/29/2009 12:01:00 AM | 3645.0000
4/29/2009 12:02:00 AM | 3677.0000
4/29/2009 12:03:00 AM | 3634.0000
4/29/2009 12:04:00 AM | 3676.0000 // ...
Hello Guys,
Im trying to query a sort of from - to date.
e.g. 20-01-2010 to 20-02-2010. this should include the mentioned dates.
i've tried the following queries but none works.
select *
from [tableName]
where date >= '20-01-2010'
AND date <= '20-02-2010'
but the date where date is equal to 20-02-2010 does not show. i don'...
Hi, I'm having trouble formulating a legal statement to double the statuses of the suppliers (s) who have shipped (sp) more than 500 units.
I've been trying:
update s
set s.status = s.status * 2
from s join sp
on (sp.sno = s.sno)
group by sno
having sum(qty) > 500;
however I'm getting this error from Mysql:
ERROR 1064 (4200...
I've created SQL command that use INNER JOIN for 9 tables, anyway this command take a very long time (more than five minutes). So my folk suggest me to change INNER JOIN to LEFT JOIN because the performance of LEFT JOIN is better, at first time its despite what I know. After I changed, the speed of query is significantly improve.
I want...
We've realised in our SQL Server 2005 DB that some Foreign Keys don't have the On Delete Cascade property set, which is giving us a couple of referential errors when we try and delete some records.
Use the Management Studio I scripted the DROP and CREATESQL's, but it seems that the CREATE isn't working correctly.
The DROP:
USE [Footpr...
I have a number and I use ROUND() function in SQL :
SELECT ROUND(1.81999,2,1)
I want the result 1.82, not 1.81.
I don't know where my mistake is.
...
I’m trying to display a list of shops each with 3 random items from their shop, if they have 3 or more listings, that are actively advertising. I have 3 tables: one for the shops – “Shops”, one for the listings – “Listings” and one that tracks active advertisers – “AdShops”.
Using the below statement, the listings returned are random ho...
hi, is it possible to alias an aggregate function in a select clause as AliasTable.AliasColumn? The reason is because I want minimum modifications in my arrays (I'm using PHP). Thanks!
P.S.
I'm using SQl Server 2008
P.S.#2
Example:
SELECT MAX(Person.name) name, MAX(Person.address) address, Farm.id,
FROM Farm
LEFT JOIN Person on Person....
I want to know
how do the 3 compare with one
another?
which one to use when?
which can be used as a replacement of
other?
...
Hi, I have 2 tables in the database with the following attributes:
Booking
=======
booking_id
booking_start
booking_end
resource_booked
===============
booking_id
resource_id
The second table is an associative entity between "Booking" and "Resource" (i.e., 1 booking can contain many resources). Attributes booking_start and booking_en...
Is it any safer to create a table holding user information and another one for their passwords than using the same table for everything?
...
If I use this class to do a
SELECT * FROM ...
statement against a database, what method or variable of this class should I use just to give me a dump of the output from the SQL statement?
...
Hi
I have 2 tables Order and orderDetails table...
I have written a inner join
SELECT Order.id
FROM Order
INNER JOIN orderDetails
ON Order.id=orderDetails.id
I have got the output as
id
100
100
100
101
101
from the above data i want the count of each record
OUTPUT AS :
id count
100 3
101 2
he...
This is a follow-up to my previous question (Thanks for the answer, BTW!)
If I have two loops:
while @@fetch_status=0
begin
set y=y+1
set x=0
while @@fetch_status=0
begin
x=y+1
if y = 5
'exit the second do while and back to the first do while --> y=y+1
end
end
...how can I exit from the...