i got this
now for some reason i think it sees the number as a date, it should be n varchar and then convert it into a int, then i get this error
Conversion failed when converting datetime from character string.
and here is my sql
the ponumber will be the same as the grid number if i get it to work
Code:
substring('PA-1501200', 4 , 99)
Conversion failed when converting datetime from character string.
and here is my sql
the ponumber will be the same as the grid number if i get it to work
Code:
declare @PONumber varchar(50)
declare @GridNumber varchar(50)
--set @PONumber =
set @GridNumber = substring('PA-1501200', 4 , 99)
select * from int_err_PutAway_writeback
where
((refno = @PONumber) and isnull(@PONumber,'') <> '')
or
((refno = @GridNumber) and isnull(@PONumber,'') = '')
and err_datetime is not null
union all
select *, ' ' ab_res from int_err_Receive_writeback
where
((refno = @PONumber) and isnull(@PONumber,'') <> '')
or
((refno = @GridNumber) and isnull(@PONumber,'') = '')
and err_datetime is not null
union all
select * from int_err_ibtPutAway_writeback
where
((refno = @PONumber) and isnull(@PONumber,'') <> '')
or
((refno = @GridNumber) and isnull(@PONumber,'') = '')
and err_datetime is not null
union all
select *, ' ' ab_res from int_err_ibtReceive_writeback
where
((refno = @PONumber) and isnull(@PONumber,'') <> '')
or
((refno = @GridNumber) and isnull(@PONumber,'') = '')
and err_datetime is not null
order by err_datetime desc
Comment