Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Can we Pass table valued parameters and normal params like integer,varchar etc..to a single stored procedure?If we can then how to pass them? I currently have the following

ALTER PROCEDURE InsertData
(
@slno nvarchar(255),
@OrderNo nvarchar(255),
@M3 M3 READONLY
)

when i pass params from front end it gives me error " String or binary data would be truncated.The data for table-valued parameter "@M3" doesn't conform to the table type of the parameter.The statement has been terminated."
Posted
Updated 9-Jun-20 5:29am
Comments
Dnyaneshwar Kondbale 6-Feb-14 2:10am    
@slno and @OrderNo you defined as nvarchar(255), kindly check the length of the both it may be more than 255 ,or you defined M3 as type on your database kindly check the value pass for M3 having more length more than you defined.

" String or binary data would be truncated " Error occured when you try to pass or assing value
to some parameter with more than length defined for that parameter.
pwavell 6-Feb-14 2:17am    
@slno and @OrderNo length is ok.and M3 is a table type.actuly the syntax is ( @M3 M3 READONLY )and i have wriiten slno and orderno inside braces becoz if written outside braces the procedure doesnt compile.Is that the issue?
Dnyaneshwar Kondbale 6-Feb-14 2:24am    
no thats not issue.. I jst want to know you defined Type M3 in your Database , so at the time time of M3 defination you write like a as varchar(30).. n all.. I think issue you get is in M3 defination and value passed for the M3.
Saurabh_Tiwari 9-Jun-20 13:56pm    
@pwavell Could you please share the table type definition and the C# code used to call the stored procedure.

1 solution

what is @M3 M3 READONLY here...??
 
Share this answer
 
Comments
pwavell 6-Feb-14 2:12am    
M3 is a table type and @M3 is its instance.Its a table valued parameter.i m sending @M3 from front end.
Er. Ajay Chauhan 6-Feb-14 2:23am    
is M3 supported by SQl Server....?? as far as I knew that there is no datatype of M3 in SQl Server....
pwavell 6-Feb-14 4:17am    
its a user defined type

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900