October 20, 2006 at 9:31 am
SET @per=(select top 1 substring(Col001,194,2)from Empwhere substring(Col001,1,6) = 'HEAD')
If Exists(select substring(Col001,1,2)from Emp where substring(Col001,17,2)='DH'not in (@per))
Begin
RAISERROR ('Mesg')
return
end
I am getting the error at not.
October 20, 2006 at 9:40 am
Your missing something
If Exists(select substring(Col001,1,2)from Emp where substring(Col001,17,2)='DH' And substring(Col001,17,2)='DH' not in (@per))
But is easier to read if
If Exists(select * from Emp where substring(Col001,17,2)='DH' And substring(Col001,17,2)='DH' <> @per)
October 20, 2006 at 9:43 am
still am getting the same error.
October 20, 2006 at 9:45 am
I doubt if I can have multiple where clause in a single select statement
October 20, 2006 at 9:49 am
Tell me what u wanted to do. There is syntax error.
substring(Col001,17,2)='DH'not in (@per) is incorrect. what are u trying to do.
Thanks
Sreejith
October 20, 2006 at 10:17 am
I want to check
1) select substring(Col001,1,2)from Emp where substring(Col001,17,2)='HE'
2) select substring(Col001,1,2)from Emp where substring(Col001,17,2)='DH' not in (select substring(Col001,1,2)from Emp where substring(Col001,17,2)='HE')
all the records in 2 shud match with 1 other wise kick an error.
October 20, 2006 at 10:22 am
What?
Of course you can have multiple items in the where clause, Unfortunatelly I wasn't paying attention when I posted
Try this.
If Exists(select substring(Col001,1,2)from Emp where substring(Col001,17,2)='DH' And substring(Col001,17,2) not in (@per))
October 20, 2006 at 10:50 am
syntax is working but unable to filter the records from not in
October 20, 2006 at 11:04 am
I want ur question in Plain English (No Not IN...)
what column are u checking in NOT IN Clause?
October 20, 2006 at 11:12 am
Fine,
Can you post a table definition, some sample data, and what you want as an expected result.
Thx
October 20, 2006 at 11:52 am
I am checking @per in my NOT IN caluse, uou can check my 1st posted mesg.
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply