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
 SQL Server Development (2000)
 Efficient varchar grouping

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-08 : 09:53:24
Catalin L writes "I have a table with three varchar(200) fields.
I need grouping(counting) on these fields.

for ex:
field1
val1
val2
val1

I need to say that val1 has appeared 2 times and val2 1 times.

Because the fields size are big I guess an index could not help to much. The number of inserts in that table is about 50000-100000 a day. How can I design the database to obtain the optimum speed.

Thanks."

Nazim
A custom title

1408 Posts

Posted - 2002-04-08 : 10:03:11
How Big???.

the maximum a varchar can hold is 8,000 bytes. and it shouldnt be a problem (until you use multiple varchar columns and they execeed the max row size)

you can query your table to get what you want in this way

select columname,count(1000)
from tablename
group by columnname

HTH

--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -