|
lirsari
Starting Member
2 Posts |
Posted - 2010-04-07 : 05:17:28
|
| hi,i'm receiving this error:Conversion failed when converting the varchar value 'select distinct u.id, u.firstname, replace(u.company,1,'yes') as company, r.Ethnicity_name, a.appliedDate, t.positionTitle, p.Position_Name, js.jobSpecialization_name, ve.*, o.salary, replace(negotiable,'off','Negotiable') as negotiable,c.city, s.State_name from User u, jobApplication a, jobPost j, Career t, Education e, Others o, Contact c, Position p, jobSpecialization js, viewEducation ve, State s, Ethnicity r where u.id = a.id and a.jobPostID = j.jobPostID and u.id = t.userid and u.id = e.userid and u.id = o.userid and u.id = c.userid and t.Position_Id = p.Position_Id and t.jobSpecialization_Id = js.jobSpecialization_Id and e.userid = ve.id and u.Ethnicity = r.Ethnicity_id and c.state = s.State_id and ( u.firstname like '%muna%' or u.lastname like '%muna%' )and j.jobPostID = ' to data type int.when running this SP: ALTER procedure [dbo].[Recruit]( @jid int, @name varchar(200), @ic varchar(200), @race int, @gender varchar(200))as declare @sql nvarchar(4000)select @sql = 'select distinct u.id, u.firstname, replace(u.tm,1,''yes'') as tm, r.Ethnicity_name, a.appliedDate, t.positionTitle, p.Position_Name, js.jobSpecialization_name, ve.*, o.salary, replace(negotiable,''off'',''Negotiable'') as negotiable, c.city, s.State_name from Users u, jobApplication a, jobPost j, Career t, Education e, Others o, Contact c, Position p, jobSpecialization js, viewEducation ve, State s, Ethnicity r where u.id = a.id and a.jobPostID = j.jobPostID and u.id = t.userid and u.id = e.userid and u.id = o.userid and u.id = c.userid and t.Position_Id = p.Position_Id and t.jobSpecialization_Id = js.jobSpecialization_Id and e.userid = ve.id and u.Ethnicity = r.Ethnicity_id and c.state = s.State_id and ( u.firstname like ''%'+@name+'%'' or u.lastname like ''%'+@name+'%'' ) and j.jobPostID = '+ @jid if (@race is null) and (@gender is null) select @sql = @sql + ''-- else -- if @race is not null-- select @sql = @sql + ' and u.Ethnicity = ' + convert(varchar(2),@race) exec (@sql) return @@errorit works fine if i don't put this on >> and j.jobPostID = '+ @jid please help.. |
|