Question: Hi, everyone. I need a help for SQL stored procedure. I have two tables, which table (A) which have Columns called Category, Code and Description

Hi, everyone.

I need a help for SQL stored procedure.

I have two tables, which table (A) which have Columns called Category, Code and Description and a table (B) which have columns called Reason and ReasonDescription.

in table (A) on column Code I have a DATA on each row such as 101 and in column Description, has data which describe each data from Column Code such as in the first row in column Code has value 101 then in column Description have data 'hello world' and in second row column Code has value 102, Description have data 'Hello Hello'. AND, in Table (B), on column Reasons, I have a value which is coming from Table (A) Column Code and each Value separated by ( | ) SUCH AS 102|103|101 or 101|201 or 101 and so on, and i want to have a DATA from table (A) column Description into column ReseanDescription in table (B), can anybody help for this, please?

and this is my code and the error I am getting.

select * from A left join B on A.Reasons = B.Code and B.Category=500 where Reasons is not null

Msg 245, Level 16, State 1, Line 1

Conversion failed when converting the varchar value '202 |' to data typesmallint.

Best Regards

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!