Friday, October 4, 2013

How i can prevent from repeating 'unit_name' in table

Here you have the modified one though not tested. I missed out the SELECT part.



ALTER proc [dbo].[unit_ins](@vv unit_insert readonly)
as
begin
if not exists(select null from unit where unit_name in (select unit_name from @vv))
insert into unit(unit_name) select unit_name from @vv
end





Regards, RSingh


No comments:

Post a Comment