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
 check constraint

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2007-07-24 : 07:30:57
declare @taxregcode varchar(100)
declare @entitycd varchar(100)
set @taxregcode='pntcircle'
set @entitycd='NA'


select * from trd_tax_group_hdr A (nolock),
trd_tax_group_dtl B (nolock)
where
and tax_id=tg_taxid
and isnull(tax_region,'ALL') = Isnull(@taxregcode,'ALL')
and isnull(item_code,'NA')= isnull(@entitycd,'NA')
and tax_type = 'SER'

for the above query iam passing taxregcode,entitycd with value as assigned.first
it is should check whether the passed data (@taxregcode) exist in a column tax_region(trd_tax_group_hdr table)
if passed value not exist in table i should assign 'all' for both side..
the above query is not working..
   

- Advertisement -