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
 realtime question

Author  Topic 

tejo krishna yadavalli
Starting Member

3 Posts

Posted - 2015-02-21 : 12:22:22
Hi,

We are having tbl_workorderheader with columns fld_workorder, fld_puremixflag. type is nvarchar for both.

Data for workorder column is like '123-RM000000001-1' represents rawmaterial or '123-BM000000001-1' represents premixmaterial

puremixflag column data is like 'PURE' or 'MIX'

I have to select either rawmaterial workorders or premix workorders based on puremixflag... So pls tell me how to do it in stored procedure..

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2015-02-21 : 14:56:16
create proc myprod @puremixflag char(4)
as
select fld_workorder
from tbl_workorderheader
where @purmixflag = 'PURE' and fld_workorder like '[0-9][0-9][0-9]-RM%'
or @purmixflag = 'MIX' and fld_workorder like '[0-9][0-9][0-9]-BM%'
;
go
Go to Top of Page
   

- Advertisement -