I want to check if SID exists in table sms_messages first, if it does not, I want to insert my data into sms_messages. I also want a status to say, if 1, it is inserted to a table, if 0 then no. I only want the result to return 0 or 1.
create procedure Insert_msg
if not exists
(select [sid] from sms_messages where sid = @sid)
insert into sms_messages (sid, date_received, direction, sent_from, [status], body) values
(@sid, date_received, direction, sent_from, @status, @body)
status = 1
status = 0