Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Ho to Write Query for dynamic in sql server for IN operation.

$
0
0

hi ,

we was write store procedure dynamically for IN operation,when i select 4 values it was update only 3 item last selected values are not update .if select more then 5 it will showing the below error

ALTER PROCEDURE [dbo].[UpdateEMPdetails]  
  (  
   @NID varchar(50),  
   @EID nvarchar(max),  
   @RT bit,  
   @Ackd bit,  
   @VerifiedBy varchar(80),  
   @TableName varchar(100)  
   )  
 as      
  declare @SqlQueary nvarchar(max)  
  set @SqlQueary = 'update '+ @TableName +' set RT='+CAST(@Rt AS CHAR(1))+',Ackd='+CAST(@Ackd AS CHAR(1)) +',Verified_By='''+@VerifiedBy+''' where NID='''+@NID+''' and ' + 
  ' EID in('''+ @EID+''''+')'  
 print @SqlQueary 


 exec UpdateEMPdetails 'EMP14-302',"000008922','00000010242','000008923','00000010242','0000008922','00000010242','0000008922','00000010242",1,1,'xyz','EMPTB'

when i run this one we will getting the below error

Msg 103, Level 15, State 4, Line 1
The identifier that starts with '0000008922','00000010242','00000008922','00000010242','0000008922','000000010242','00' is too long. Maximum length is 128.




Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>