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.
Author |
Topic |
ilimax
Posting Yak Master
164 Posts |
Posted - 2010-09-14 : 10:17:10
|
I have some tables that are created on fly by ID column from Table1.Table2_100Table2_101Table2_102I want to pull IDs from Table1 that object Table2_ID does not exist.Anybody have idea how I can make this? |
|
CSears
Starting Member
39 Posts |
Posted - 2010-09-14 : 10:33:44
|
Without a better explanation I would say possibly using a WHERE Table1_ID NOT IN (SELECT Table2_ID FROM Table2)clause. |
|
|
ilimax
Posting Yak Master
164 Posts |
Posted - 2010-09-14 : 16:01:41
|
Definatelly that is not what I asked for ... |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-09-14 : 16:51:15
|
[code]select IDfrom table1where not exists(select * from sys.objects where name = 'Table2_'+convert(varchar(10),table1.ID) and type='U')[/code] No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
ilimax
Posting Yak Master
164 Posts |
Posted - 2010-09-14 : 17:14:54
|
That one is great .. works great .. Thank you very much. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-09-14 : 17:16:07
|
welcome No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
|
|
|