i have stored proc this: create procedure [dbo].[insertinput] (@resourcetag int, @element varchar(50), @periodid int, @backpay varchar(50), @inputvalue decimal(18,5), @userid varchar(50), @source varchar(50), @inputdate datetime, @sourceid int, @comments varchar(200), @processid int, @tablecode int, @scopeid int = null output) begin insert [dbo].[input] ([resource tag] ,[element] ,[period id] ,[back pay], [input value], [user id], [source], [input date], [source id], [comments], [process id]) values(@resourcetag, @element, @periodid, @backpay, @inputvalue, @userid, @source, @inputdate, @sourceid, @comments, @processid) set @scopeid = (select scope_identity()) end now have added parameter @tablecode, , depending on value, above insert statement should go different tables. example, if @tablecode = 0, insert [dbo].[input]... if @tablecode = 1, insert [dbo].[input1]... so tried adding case statement snippet: insert case when @tablecode = 0 [dbo].[input] ([resource tag] ,[...