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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Find the Missing Records
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

lkiran086
Starting Member

21 Posts

Posted - 07/15/2014 :  06:25:20  Show Profile  Reply with Quote
Hi

I have a table contains one column.It has numbers 1 to 100 but some numbers are missing.

how can I find the missing numbers ?

webfred
Flowing Fount of Yak Knowledge

Germany
8781 Posts

Posted - 07/15/2014 :  06:50:44  Show Profile  Visit webfred's Homepage  Reply with Quote
Try this:

select dt.number from
(select number from master..spt_values
 where type = 'P' and
 number between 1 and 100)dt
left join YourTable t on t.YourColumn = dt.number
where t.YourColumn IS NULL



Too old to Rock'n'Roll too young to die.
Go to Top of Page

lkiran086
Starting Member

21 Posts

Posted - 07/16/2014 :  09:10:16  Show Profile  Reply with Quote
Thanks
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000