# Database Discussions > Microsoft SQL Server 2008 >  Select All Document IDs in a DataBase

## keega

Hi all!

I am new here. I am also new to SQL. Here's what I am trying to accomplish:

Select all (unique) document IDs in a given database. I'd like to have them display. Here is one of the queries for what I've done thus far:

SELECT docid 
FROM _data_base_
WHERE docid > '0';

Which returns only the column "docid". I was hoping for the actual numbers, not merely the column. 

What am I doing wrong?

Thank you in advance!

keega

----------


## rmiao

Is it for sql server? Do you know table schema?

----------


## keega

It is for SQL Server. Not sure of the table schema...second day doing SQL  :Confused:  I was able to extract the info I needed, however. I'd post what I did, but it's soooo basic, you all probably already know this.

----------


## keega

But thank you rmiao, knowing you guys/gals are here makes me feel pretty comfortable!  :Wink:

----------


## skhanal

This will give you a list of docid and count for each

SELECT docid, count(*)
FROM data_base
group by docid

----------


## keega

Thank you skhanal! 




> This will give you a list of docid and count for each
> 
> SELECT docid, count(*)
> FROM data_base
> group by docid

----------

