January 16, 2006 at 2:32 pm
I am working a function:
declare @AccCharge int
declare @zipfrom varchar
declare @zipto varchar
set @zipfrom ='33786'
set @zipto = '32174'
begin
IF @ZipFrom in (select zip from t_RATE a join t_ZIP b ON a.state=b.state)
set @AccCharge = 213
return (@AccCharge)
--Print (@AccCharge)
end
Problem is this won't return anything unless I swap the @ZipFrom in the IF statment with an actual value IF 01234 in (select zip from t_RATE a join t_ZIP b ON a.state=b.state)
Any ideas?
January 16, 2006 at 2:35 pm
IF EXISTS (
SELECT * from t_RATE a
join t_ZIP b ON a.state=b.state
WHERE a.zip = @ZipFrom 
BEGIN
END
January 16, 2006 at 2:57 pm
Thanks PW! Actually my query does work. The problem I was having was I didn't specify the varchar size. It needed to be the same as the table. Thank you.
January 17, 2006 at 6:29 pm
Yeah, if you don't specify a length for varchar it defaults to 30 chars or something obscure like that...
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply