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 3rd ROW

Author  Topic 

aks
Starting Member

28 Posts

Posted - 2005-03-10 : 13:09:46
I have a table with few columns
uid int id
1655 1121 4567
1655 1122 4568
1655 67 4569
1655 1121 4570
1655 1122 4571
1655 78 4572
2111 1121 5678
2111 1122 5679
2111 69 5680..........

I need only 3rd row of 2nd column(int) which is
UID INT
1655 67
78
2111 69

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-10 : 13:14:21
select identity(1, 1) as inc, uid, int, id
into #temp
from Table

select uid, int, id
from #temp
where inc%3 = 0

Go with the flow & have fun! Else fight the flow
Go to Top of Page

aks
Starting Member

28 Posts

Posted - 2005-03-10 : 13:25:34
It say"Incorrect syntex near"1""
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-10 : 13:28:01
sorry:
select identity(int, 1, 1) as inc, uid, int, id
from ...

Go with the flow & have fun! Else fight the flow
Go to Top of Page

aks
Starting Member

28 Posts

Posted - 2005-03-10 : 13:39:28
Its again giving me error'Column or parameter #0,Cannot find data type int'
Go to Top of Page

PW
Yak Posting Veteran

95 Posts

Posted - 2005-03-10 : 13:51:20
Be careful with this:

select identity(1, 1) as inc, uid, int, id
into #temp
from Table

This is not guranteed to work.
See: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q273586

You need to create the temp table 1st, then insert into it with the order by.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-03-10 : 14:00:36
thanks PW, didn't know that.

aks are you maybe using oracle?

Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -