Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Select query to get the max points in a field

Author  Topic 

reddymade
Posting Yak Master

165 Posts

Posted - 2005-05-13 : 11:51:01
I have the table Tasks: and fieldname is Taskcode:

In the Taskcode: i can enter .01 or .01.102 or .01.102.103 like that

So i have to find searching all rows in that table for that field to see where maximum points are.
each point represents one level:

if it is .01 only it is only one level since it has only one point in it.

if it is .01.12.14 then it has three levels, i see there are three points in it.

once i establish the maximum levels then i can do the other stuff.

Can you please tell me, is it possible to get that info.

Table name is Tasks and field name is Taskcode.

Please Help, Thank you very much for the information.

SreenivasBora
Posting Yak Master

164 Posts

Posted - 2005-05-13 : 12:23:18
Hey,

This is just like counting of spaces Or comms in a string type of logic. By using T-sql we can do

1. select len(rtrim('.01.12.14')) - len(replace(rtrim('.01.12.14'), '.', ''))

2. Write a simple Loop
Read Char by char and count the '.'


With Regards
Sreenivas Reddy B
Go to Top of Page

reddymade
Posting Yak Master

165 Posts

Posted - 2005-05-13 : 12:44:24
Hello Srinivas,
Can you please if you don't mind. give me the full query to make the select query to get the max points for the row using the point(.).
Thank you very much.

quote:
Originally posted by SreenivasBora

Hey,

This is just like counting of spaces Or comms in a string type of logic. By using T-sql we can do

1. select len(rtrim('.01.12.14')) - len(replace(rtrim('.01.12.14'), '.', ''))

2. Write a simple Loop
Read Char by char and count the '.'


With Regards
Sreenivas Reddy B

Go to Top of Page
   

- Advertisement -