SQL Server Forums
Profile | Register | 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
 New Topic  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
8765 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  
 New 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.03 seconds. Powered By: Snitz Forums 2000