Help Requested : Finding The 6 Closest Points
Sep 4, 2007
Hi all,
I am seeking your expertise to create SQL codes (SQL server 2005) that can help me to answer the problem below.
I have two tables (points and station), presented in form of SQL codes below. Id like to find the 6 closest panels for each of the station. As can be seen in the result table below, the 6 closest panel names are arranged from the first closest (P1) to the sixth closest (P6). Similar procedure also applies for the distance column arrangement. This distance column (D1 D6) is the distance of panels P1 P6 to the station. The distance between two points (with x-y coordinates) can be calculated using a simple Cartesian formula:
Distance = ( (X1 X2)2 + (Y1 - Y2)2 ) 0.5 . As the sample, distance between station A and panel P19-04W is = ((737606.383 - 737599.964)2 + (9548850.844 - 9548856.856)2) 0.5 = 8.79.
The expected result of the work is presented in the table below:
Panel
distance
Station
P1
P2
P3
P4
P5
P6
D1
D2
D3
D4
D5
D6
A
P19-04W
P19-06E
P19-05E
P19-05W
P19-03W
P19-07E
8.79
12.00
13.54
19.02
21.00
27.43
B
P19-07W
P19-09E
P19-08E
P19-06W
P19-08W
P19-07E
9.50
11.58
12.92
21.15
24.85
29.11
C
P19-11E
P19-10W
P19-12E
P19-09W
P19-10E
P19-11W
8.45
11.42
16.06
16.38
23.15
25.30
Table 1:
create table 1 (
Panels varchar(20),
X_Coord float,
Y_Coord float
)
go
set nocount on
insert into 1 values('P19-03E','737640.722','9548882.875')
insert into 1 values('P19-04E','737630.166','9548868.3')
insert into 1 values('P19-05E','737619.611','9548853.726')
insert into 1 values('P19-06E','737609.054','9548839.15')
insert into 1 values('P19-07E','737598.495','9548824.571')
insert into 1 values('P19-08E','737587.941','9548809.998')
insert into 1 values('P19-09E','737577.386','9548795.425')
insert into 1 values('P19-10E','737563.359','9548776.163')
insert into 1 values('P19-11E','737552.795','9548761.578')
insert into 1 values('P19-12E','737542.256','9548746.919')
insert into 1 values('P19-13E','737531.701','9548732.345')
insert into 1 values('P19-14E','737521.146','9548717.772')
insert into 1 values('P19-03W','737610.519','9548871.43')
insert into 1 values('P19-04W','737599.964','9548856.856')
insert into 1 values('P19-05W','737589.404','9548842.275')
insert into 1 values('P19-06W','737578.849','9548827.702')
insert into 1 values('P19-07W','737568.294','9548813.128')
insert into 1 values('P19-08W','737554.274','9548793.77')
insert into 1 values('P19-09W','737543.718','9548779.195')
insert into 1 values('P19-10W','737533.157','9548764.614')
insert into 1 values('P19-11W','737522.603','9548750.041')
set nocount off
go
Table 2:
create table 2 (
Station varchar(20),
X_Coord float,
Y_Coord float
)
go
set nocount on
insert into 2 values('A','737606.383','9548850.844')
insert into 2 values('B','737575.41','9548806.838')
insert into 2 values('C','737544.437','9548762.832')
set nocount off
go
Thanks alot in advance!
View 9 Replies
ADVERTISEMENT
Jun 22, 2007
Greetings everyone, I'm posting this thread with the hope that someone will notice it and might offer me a helping hand regarding one of my problems.I have the database named "DBEXAMPLE" with the table MEMB_INFO that contains two important columns that are named cur_points and points where cur_points column contains the total available points that a member can use/spend on a game and the points column stores the total of the points that a member used so far.So as i plan to wipe all data of the database, i need to keep the member login,password and total points that each member purchased.So i will somehow need to update the cur_points column with the total of current cur_points+points columns and then wipe points column.I've personally asked a friend regarding this and he said that this should be something complicated and it might require php also.Really appreciate if someone could help me regarding this.small schema:Database: DBEXAMPLETable: MEMB_INFOColumn cur_points -> total available points that a member can spendColumn points -> total points that the member has already spentColumn memb___id -> member login aka account idTODO -> update cur_points column with the total of cur_points+points columns for each member(buyer)With best regards.
View 5 Replies
View Related
Mar 15, 2002
I want to do a calc using the closest birthday...
declare @bday datetime ,@past_bday int ,@next_bday int ,@age int
set @bday = '12/25/1973'
--
-- some code goes here to assign values to past & next bday
--
if @past_bday < @next_bday
set @age = @age
else if @past_bday > @next_bday
set @age = @age + 1
TIA
JeffP...
View 1 Replies
View Related
Jul 13, 2002
Is there any way in SQL of selecting a date closest to another date.
i.e. I have a date say 4/4/2002, and in the database I have dates 4/2/2002 and earlier and 4/7/2002 and later.
I want to do a query and return the date 4/2/2002 as it is only 2 days away even though it is an earlier date.
So short of writing a loop and saying if the date is eq then good else, take date and add a day if not correct take initial date and subtract a day etc etc. This way is proving to be a little too processor heavy.
Thanks
View 2 Replies
View Related
Jan 8, 2015
Iβm trying to write a query that will select closest value to Amount field in #TestValue without go over #SM.GMAdj value.Outcome of the query should be something like
PercRate Amount Code GMAdjPayment
-------------- ----------- ---------------------------------
6.00 ----172715 -----13-------171314.36------900
7.00 ----200200 -----18-------200299.00------500
Tables are:
SELECT PercRate, Amount, Code
INTO #TestValues
FROM (
SELECT 6.00, 172715, 13 UNION ALL
SELECT 6.50, 172716, 13 UNION ALL
SELECT 7.00, 181351, 13 UNION ALL
SELECT 7.50, 190419, 13 UNION ALL
[code]...
View 2 Replies
View Related
Jul 20, 2005
Hello,I need help in writing a SQL statement in MS SQL Server 2000 to selectthe latest date (i.e., the date closest to or equal to the current date)for a given date.For example, in a table I have the following records:Date Exchange-Rate01/Sep/03 0.5505/Sep/03 0.59If the given date is 02/Sep/03, then the rate 0.55 should be return.If the given date is 03/Sep/03, then the rate 0.55 should be return.If the given date is 04/Sep/03, then the rate 0.59 should be return.Thanks in advanced,Benny*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 8 Replies
View Related
Nov 5, 2007
I'm trying to manipulate the data in my Service_2 column to round off the Estimated_Miles to the closest 5K miles. I tried the round function (Round(EstimatedMiles, -4)) but this does not exactly give me the results I want. Below is my result set:
Row_ID
Service_2
Estimated_Miles
1
40000
44012
2
50000
46124
3
120000
121512
4
30000
31857
5
10000
7547
6
80000
79500
And below is what I'd like to have
Row_ID
Service_2
Estimated_Miles
1
45000
44012
2
50000
46124
3
125000
121512
4
35000
31857
5
10000
7547
6
80000
79500
The range of data I'm working with is pretty broad meaning my Min & Max Estimated_Miles is between 0 - 1,000,000. In essence, I would like to say is if the estimated mileage is between 0-4999 then Service_2 = the closest 5K miles otherwise round to the closest 10K miles. Any help is truly appreciated. Thanks
View 11 Replies
View Related
Apr 9, 2008
Okay, I have a table that is arranged like so:
ID: (primary, auto generated)
Work order : (non unique foreign key)
Status: Internal status
Modified date: date time of status change to work order
This keeps track of our work order status changes. We'd like to trend our internal orders and monitor status durations (so to know how long each work order spend on a particular status). Now, the only thing is missing is an "end date/time", thus I must generate it in either a query or a SQL report form. The issue, is that i need the "modified date" from the next highest combination of work order + ID values (since they are the only reference). Is there any way to get this to happen? So essentially, if I sort by "work order" and then "id", i'd want the "modified date" value from line 2 to be on line 1, and so on. Now, if the "work order" number changes, or there isn't a higher work order+ID, we leave it blank and move on. Any ideas?? I'm really stuck.
Thanks in advance,
Josh
View 7 Replies
View Related
Oct 5, 2007
I have a need to execute a query in T-SQL on a numeric field in a SQL table.
However if there is no exact match I'd likea query that will return the row that is just below my value.
As an example if the table has values: 1,2,4,5,7,9, 15 and 20 for instance and I am matching with a varibale containing the value 9 then I'd like it to return that row. however if my variable has the value 19 I want the row containign 15 returned.
Is this possible? Can anyone help me with such a query?
Regards
Clive
View 6 Replies
View Related
Feb 20, 2006
I apologise if this is a stupid question, but I would appreciated anyhelp on this subject.I want to create a view (VIEW_1 in example below) where I take numericvalues from a field in one table (DEPTH_FROM in TABLE_1) and find theclosest matching values from another field in another table (DEPTH_ATin TABLE_2) - the higher matching value and the lower matching value.TABLE_1BH_ID DEPTH_FROMB1 10.6B1 14.2B1 16.1B1 17.0TABLE_2BH_ID DEPTH_ATB1 9B1 10B1 11B1 12B1 13B1 14B1 15B1 16B1 17B1 18VIEW_1BH_ID DEPTH_FROM DEPTH_LOWER DEPTH_HIGHERB1 10.6 1011B1 14.2 1415B1 16.1 1617B1 17.0 1717Any assistance would be appreciated.Regards,Hennie
View 2 Replies
View Related
Aug 9, 2007
I have included the create table statements, sample data and a stored procedure.
I have a stored procedure that walks the associations so that I can assemble all the nodes of the tree. I think this is working properly.
I have two requests/needs/problems that I need to solve:
(1)
I want to create a NEW stored procedure that takes a WhoID and an AssocID.
This new stored procedure would show the shortest or closest path between WhoID and AssocID.
For example, if I pass in 6,1 to this new proc I want the stored procedure to return the hierarchy with the closest path between them. Based on the sample data below, the path would be
6 - 8
8 - 2
2 - 3
3 - 1
(2)
I might also need a proc that accepts two inputs (again, lets use 6,1) but would show all paths / branches of the tree where person 1 exists. Based on the stored procedure procCTE_Assoc 6, this solution would exclude the "fred and jeff" node but would include the other two nodes because person 1 is within the other two nodes.
Please provide your suggestions, comments, or solutions!
CREATE TABLE dbo.Who(
WhoID bigint IDENTITY(1,1) NOT NULL,
FName varchar(50) NOT NULL
)
GO
CREATE TABLE dbo.Assoc(
WhoID bigint NOT NULL,
AssocID bigint NOT NULL
) ON PRIMARY
SET IDENTITY_INSERT dbo.Who ON
GO
INSERT INTO Who (WhoID,FName) VALUES (1,'user1')
INSERT INTO Who (WhoID,FName) VALUES (2,'user2')
INSERT INTO Who (WhoID,FName) VALUES (3,'admin1')
INSERT INTO Who (WhoID,FName) VALUES (4,'admin2')
INSERT INTO Who (WhoID,FName) VALUES (5,'admin3')
INSERT INTO Who (WhoID,FName) VALUES (6,'Keith')
INSERT INTO Who (WhoID,FName) VALUES (7,'fred')
INSERT INTO Who (WhoID,FName) VALUES (8,'Joe')
INSERT INTO Who (WhoID,FName) VALUES (9,'Jack')
INSERT INTO Who (WhoID,FName) VALUES (10,'Doug')
INSERT INTO Who (WhoID,FName) VALUES (11,'Mark')
INSERT INTO Who (WhoID,FName) VALUES (12,'Al')
INSERT INTO Who (WhoID,FName) VALUES (13,'Jeff')
INSERT INTO Who (WhoID,FName) VALUES (14,'Brandon')
INSERT INTO Who (WhoID,FName) VALUES (15,'Ashley')
INSERT INTO Who (WhoID,FName) VALUES (16,'Lisa')
INSERT INTO Who (WhoID,FName) VALUES (17,'Julie')
INSERT INTO Who (WhoID,FName) VALUES (18,'Brian')
go
SET IDENTITY_INSERT dbo.Who OFF
GO
INSERT INTO Assoc (WhoID,AssocID) VALUES (1,4)
INSERT INTO Assoc (WhoID,AssocID) VALUES (2,1)
INSERT INTO Assoc (WhoID,AssocID) VALUES (2,3)
INSERT INTO Assoc (WhoID,AssocID) VALUES (6,7)
INSERT INTO Assoc (WhoID,AssocID) VALUES (6,8)
INSERT INTO Assoc (WhoID,AssocID) VALUES (7,13)
INSERT INTO Assoc (WhoID,AssocID) VALUES (8,2)
INSERT INTO Assoc (WhoID,AssocID) VALUES (14,8)
INSERT INTO Assoc (WhoID,AssocID) VALUES (6,15)
INSERT INTO Assoc (WhoID,AssocID) VALUES (15,18)
INSERT INTO Assoc (WhoID,AssocID) VALUES (15,17)
INSERT INTO Assoc (WhoID,AssocID) VALUES (17,5)
INSERT INTO Assoc (WhoID,AssocID) VALUES (5,1)
go
create proc dbo.procCTE_Assoc
@WhoID bigint
AS
WITH GroupsCTE (WhoID, AssocID, FName, FNameAssoc, Lvl, Sort, GroupWithIndent)
AS
(
-- Anchor Who definition
SELECT M.WhoID, MA.AssocID, M.FName, AssocWho.FName, 0 AS Lvl,
CONVERT(varchar(2000),AssocWho.FName) AS Sort,
CONVERT(varchar(255), AssocWho.FName)
FROM Who M
INNER JOIN Assoc MA ON M.WhoID = MA.WhoID
INNER JOIN Who AssocWho ON AssocWho.WhoID = MA.AssocID
WHERE M.WhoID = @WhoID
UNION ALL
-- Recursive Who definition
SELECT g1.WhoID, MA1.AssocID, g1.FName, g2.FName, Lvl + 1,
CONVERT(varchar(2000),RTRIM(Sort) + '|' + g2.FName),
CONVERT(varchar(255), REPLICATE ('| ' , Lvl+1) + g2.FName)
FROM Who g1
INNER JOIN Assoc MA1 ON g1.WhoID = MA1.WhoID
INNER JOIN Who g2 ON g2.WhoID = MA1.AssocID
INNER JOIN GroupsCTE CTE
ON MA1.WhoID = CTE.AssocID
)
SELECT *
FROM GroupsCTE
ORDER BY Sort
RETURN (0)
GO
exec procCTE_Assoc 6
View 5 Replies
View Related
Mar 27, 2001
i have a column of dates.
i make an index or key for this column so that
i can perform binary search i hope.
If the search is not succesful how do
i get the query to return the two dates
surrounding the date i was searching for.
View 2 Replies
View Related
Apr 21, 2015
I have two tables and I am trying to pull a value closest to another date. Β There could be instances where the Eval_date in TableA matches the date in TableB so how would that be handled?
TableA
PA_IDEval_Date
12015-01-08 00:00:00.000
22015-01-25 00:00:00.000
TableB
IDPA_IDDate Stat
112015-01-15 00:00:00.000 14
222015-01-28 00:00:00.000 8
312015-01-16 00:00:00.000 2
422015-01-029 00:00:00.000 3
512015-01-09 00:00:00.000 11
612015-03-14 00:00:00.000 14
Expected Results
PA_IDDate Stat
12015-01-09 00:00:00.000 11
22015-01-28 00:00:00.000 8
View 8 Replies
View Related
Mar 10, 2014
I have a temperature table with a column that shows the how many hours old a newborn was when his/her temperature was taken.
Example lets say once per hour.
I want to join to a table called Weight that records the newborns weight at any given time.
Example lets say 3x during the day.
1 @ 8:45am
2 @ 11:15am
3 @ 4:30pm
I want to figure out which weight recording is the closest to a given temperature recording and return that one row.
View 2 Replies
View Related
Nov 12, 2015
What I'm trying to select is the closest value from a list given by a parameter or select the matched value.
declare @compare as int
set @compare = 8
declare @table table
(
Number int
)
insert into @table
values(1),
(2),
(3),
(4),
(5),
(10)
If the parameter value match one of the values from the table list, select that matched one.If the value does not exist in the table list, select the closest lower value from the table list, in this case, it would be value 5.
View 3 Replies
View Related
Jul 23, 2007
I'd like to get some ideas for the following:
I am writing a quick mini-application that searches for records in a database, which is easy enough. However, if the search term comes up empty, I need to return 10 records before the positon the search term would be in if it existed, and 10 records after. (Obviously the results are ordered on the search term column)
So for example, if I am searching on "Microsoft", and it doesn't exist in my table, I need to return the 10 records that come before Microsoft alphabetically, and then the 10 that come after it.
I have a SP that does this, but it is pretty messy and I'd like to see if anyone else had some ideas that might be better.
Thanks!
View 2 Replies
View Related
May 5, 2015
I'm trying to write a Stored Procedure that have to calculate the closest date for manufacturing.
What I have:
- The BOM (bill of materials) with the needed quantity for production
DECLARE @BOM TABLE
(
ItemIDINT
,neededQuantityfloat
)
INSERT INTO @BOM (ItemID, neededQuantity)
SELECT 1, 10
UNION ALL SELECT 2, 10
UNION ALL SELECT 3, 5
- a calculated table that told me the availability for each component of the BOM, sorted by date. (each row have a plus or minus of the quantity so it can by summarized)
DECLARE @WhareHouseMovement TABLE
(
ItemIDINT
,Quantityfloat
,DateDATETIME
)
INSERT INTO @WhareHouseMovement (ItemID, Quantity, Date)
SELECT 1, 10, '2015-03-01'
[Code] ....
My question is: how do I check when is the closest date to manufacturing? I have to check that the quantity of ALL the components of the BOM is enough to produce the product, but I can't get how to do it.
If I'm not wrong the example should give the result 2015-03-26.
View 9 Replies
View Related
Nov 23, 2006
I know how to create mount point in windows 20003 cluster, I am not sure how
to set it up with SQL 2005 running on the cluster.
Does sql need to be dependant on any of the disks? I have tried looking for
a guide, but cannot find.
current setup active active cluster running. I need to add san space which
will hold the databases. The san will be carved up into drive letters. each
drive letter will hold 3 mount points.
ie.
node 1
J:-2 mount point
k:2 mount point
l:2 mount point
node 2-
r:-2 mount point
s:2 mount point
t:2 mount point
each node would be able to own the disk if the other node failed over.
any help is appreciate. I have tried books online etc.. cannot find a good
step by step.;
thanks
View 1 Replies
View Related
Mar 12, 2007
HI All,
I use MSSQL as my database and ASP.NET as my front application. I want to display Price value S$23.68.
The dayatype I used is smallmoney, but it display: S$23.6800. HOw do I control the number of decimals point in the column of MSSQL??
Thanks a lot
Suigion
View 1 Replies
View Related
May 21, 2008
Dear experts,
Hi, I got a table name Employee, with the following fields
EmployeeID
Name,
ManagerID
ManagerID2,
ManagerID3,
ManagerID4 ..
ManagerID, ManagerID2, ManagerID3, ManagerID4 are all pointing to EmployeeID in the same table.
Now I want to select the all employee records where the manager NAME is like '%Raymond%'. (i.e. any of the four managers name is like '%Raymond%'.
How do I construct the select query? I tried this, but it does not work if there are more than 1 manager named 'Raymond'
DECLARE @Name varchar(50)
SET @Name = '%Raymond%'
DECLARE @EmployeeNumber nvarchar(50)
Select
@EmployeeNumber = EmployeeID
from
Employee
where
[Name] like @Name
SELECT
'HumanResources.Employee' as TableName,
E.[Name] as EmployeeName ,
isnull((Select [Name] from Employee E2 where E2.EmployeeID = E.ManagerID),'') as Manager1,
isnull((Select [Name] from Employee E2 where E2.EmployeeID = E.ManagerID2),'') as Manager2,
isnull((Select [Name] from Employee E2 where E2.EmployeeID = E.ManagerID3),'') as AppraisingManager,
isnull((Select [Name] from Employee E2 where E2.EmployeeID = E.ManagerID4),'') as ModeratingManager,
E.CurrentFlag as Active
FROM
HumanResources.Employee E
WHERE
(E.[ManagerID] = @EmployeeNumber)
or (E.[ManagerID2] = @EmployeeNumber)
or (E.[AppraisingManagerID] = @EmployeeNumber)
or (E.[ModeratingManagerID] = @EmployeeNumber))
Any help is very much appreciated.
View 5 Replies
View Related
Feb 28, 2008
I understand mount points help scalability in easier maintenance.
By scalability do we mean more than 26 drive letters or it means adding more space to the same mount point letter on with more ease .
Can I add more space to a mountpoint if required later on by adding hard disks .
Also if one can give some pointers to good file group configuration guidelines / storage align partitions , it will be very much helpful
Further I my server CPU has 4 cores , will having 4 filegroups help me in improving system performance.
If SAN has 2 controllers , is it preferred to run data file partition on one controller and log file partition on another.
Thanks in advance.
View 1 Replies
View Related
May 20, 2008
I have a column in a table with a data type of float.
When I update it to store 7.50, it changes it to 7.5
Is there any way to force it to store 2 decimal points?
View 1 Replies
View Related
Sep 25, 2007
Hello,
We have a requirement to be able to monitor mount points. The xp_fixeddrives does not support mount point monitoring. Is there another way to do it. Does microsoft working on updating the xp_fixeddrives. Let me know if anyone has any ideas how to monitor mount points.
Thanks
View 1 Replies
View Related
Jan 12, 2008
I have a user defined function, I want to determine the distance between the 2 points. I have it working but i'm having a problem getting to print.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Code Snippetcreate function dbo.Distance( @lat1 float , @long1 float , @lat2 float , @long2 float)
returns float
as
begin
declare @DegToRad as float
declare @Ans as float
declare @Miles as float
set @DegToRad = 57.29577951
set @Ans = 0
set @Miles = 0
if @lat1 is null or @lat1 = 0 or @long1 is null or @long1 = 0 or @lat2 is
null or @lat2 = 0 or @long2 is null or @long2 = 0
begin
return ( @Miles )
end
set @Ans = SIN(@lat1 / @DegToRad) * SIN(@lat2 / @DegToRad) + COS(@lat1 / @DegToRad ) * COS( @lat2 / @DegToRad ) * COS(ABS(@long2 - @long1 )/@DegToRad)
set @Miles = 3959 * ATAN(SQRT(1 - SQUARE(@Ans)) / @Ans)
set @Miles = CEILING(@Miles)
return ( @Miles )
end
DECLARE @RC float
EXEC Distance '39.943762', '-78.122265', '32.334709', '-96.633546'
PRINT @RC /* in miles */
View 3 Replies
View Related
Sep 9, 2006
Hi,I'm making a rating system that save the results in the database.I have 1 table with 3 columns:1) name2) points3) numberofvotesnow I want to select the 5 names with the best results. In other words the 5 best results when you do (points/numberofvotes)how can I say this in SQL? I hope someone can help me! thnx!
View 2 Replies
View Related
Aug 14, 2001
Previously I have posted about my problem with transaction logs. Threw my research I have found the truncate log at check point. I have also been lead to think that a check point could be a full back up. I have set this option to true and then performed a full back up. Afterward I have shrank the database to find the transaction log to still be over 43 gigs. Where have I gone astray?
Regards
SeTi_Ni
View 1 Replies
View Related
Jul 24, 2004
Hi all,
I'm trying to debug storedprocedures in query analyzer from workstation, login with server adminuser.Debugger is not stoping at break points.
any help regarding this will be greatly appreciated.
thanks.
View 2 Replies
View Related
Aug 14, 2006
I was messing around with backup strategies today at work while contemplating my other db issues.
In doing so, I've made a list of backups that don't truly exist anymore (I deleted the 'backup device' (bleh.bak).
Here's an image, stolen from technet's articles.
http://www.microsoft.com/library/media/1033/technet/images/prodtechnol/sql/2000/maintain/ppc1106_big.gif
See that list of restore points? Mine is full of restore points that have absolutely no meaning in them for a DB I made to test out (testDB).
Is there a way to clean those out?
View 1 Replies
View Related
Apr 18, 2008
DECLARE @EffLevels TABLE (ChangePoint int, Value Int)
INSERT@EffLevels
SELECT'1000', '767' UNION ALL--Changed
SELECT'1000', '675' UNION ALL
SELECT'1001', '600' UNION ALL--Changed
SELECT'1001', '545' UNION ALL
SELECT'1001', '765' UNION ALL
SELECT'1000', '673' UNION ALL--Changed
SELECT'1002', '343' UNION ALL--Changed
SELECT'1002', '413' UNION ALL
SELECT'1002', '334' UNION ALL
SELECT'1001', '823'--Changed
-- My Result should be
-- ChangePointPrevChangePointValue
-- 1000Null767
-- 1001 1000 675
-- 1000 1001 765
-- 1002 1000 343
-- 1001 1002 823
Any suggestion ?
View 9 Replies
View Related
Oct 30, 2007
Hi,
The default number of decimal points for 'money' data type is 4. Can I change it as 6?
Eg 120.123456
Thanks!
View 7 Replies
View Related
May 6, 2006
Hi allI have a large data set of points situated in 3d space. I have a simpleprimary key and an x, y and z value.What I would like is an efficient method for finding the group ofpoints within a threshold.So far I have tested the following however it is very slow.---------------select *from locations a full outer join locations bon a.ID < b.ID and a.X-b.X<2 and a.Y-b.Y<2 and a.Z-b.Z<2where a.ID is not null and b.ID is not null---------------If anyone knows of a more efficient method to arrive at this results itwould be most appreciated.Thanks in advanceBevan
View 8 Replies
View Related
Nov 1, 2006
This sounds so simple but yet don't know why it doesn't work.
i've got two decimal numbers in columns
closingUnits = 25093.53640
closingAmt = 59110.33
i use a derived column transformation to generate a string column which is the division of those two above.
mystrfield = closingAmt /closingUnits = 2.355599
what i want is cast it to just 4 decimal points when i run the expression below it cast it to 4 decimal points but it doesn't do any rounding.
the value i get is 2.3555 when i should get 2.3556
(ISNULL(closingAmt ) || closingUnits == 0) ? "0.0000" : ((closingAmt / closingUnits) < 1 && (closingAmt / closingUnits) > -1 ? "0" : "") + (DT_WSTR,15)(DT_DECIMAL,4)(closingAmt / closingUnits)
View 1 Replies
View Related
Feb 18, 2005
HI:
Is there any algorithim, which can help me write a script or SQL that will select all the points within a Closed Polygon.
This polygon and point data have latitude and longitude information
Help will be appreciated.
Thanks
Namita
View 12 Replies
View Related