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
 General SQL Server Forums
 New to SQL Server Programming
 Missing ID

Author  Topic 

chriztoph
Posting Yak Master

184 Posts

Posted - 2010-03-14 : 21:48:09
how to view all ID even is Skipped?

sample in mYtable table i have

ID
1
3
4
5
6
8
10

and the output must be
ID
1
2
3
4
5
6
7
8
9
10

show the id even it deleted..

thanks in advance..

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-14 : 23:20:01
[code]
SELECT NUMBER
FROM F_TABLE_NUMBER_RANGE(1, 10)
ORDER BY NUMBER
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

chriztoph
Posting Yak Master

184 Posts

Posted - 2010-03-14 : 23:35:56
is this working for an ID that is varchar in datatype but the inputs are numbers?the ID column properties are IsIdentity = no, allow null = no
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-15 : 00:25:45
if your data type varchar and the value is only numeric, you can convert it to integer and use the F_TABLE_NUMBER_RANGE

Since you basically want to show the complete number range regardless of the number exists or not in your table, you only need to find the max value in the table to pass to the F_TABLE_NUMBER_RANGE




KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

chriztoph
Posting Yak Master

184 Posts

Posted - 2010-03-15 : 01:33:05
thanks..
Go to Top of Page
   

- Advertisement -