Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to insert values into User DefinedTableType

Author  Topic 

mohan123
Constraint Violating Yak Guru

252 Posts

Posted - 2012-10-16 : 10:11:47
Hello all,

i am not able insert values into through store Procedure showing an error
Msg 2756, Level 16, State 1, Procedure usp_HandleException, Line 54
Invalid value 547 for state. Valid range is from 0 to 255.

in Sp side i pass three parameters @i_AppUserId KEYID ,
@i_PatientUserId KEYID ,
@t_tUserMeasure tUserMeasure readonly

in that one is @t_tUserMeasure User DefinedTableType
(MeasureId
MeasureUOMId
MeasureValueText
MeasureValueNumeric
Comments
datetaken
DataSourceid)
and rest of the columns outside :

isPatientAdministered ,
DueDate ,
StatusCode ,
CreatedByUserId,
now i am executing to insert like this

declare @t_tUserMeasure tUserMeasure
insert into @t_tUserMeasure values(1,1,'quantity','Testing','20120720',1)

exec [usp_UserMeasure_MultiInsert]
@i_AppUserId = 23,
@i_PatientUserId = 226650,
@t_tUserMeasure = @t_tUserMeasure

but no result???????

P.V.P.MOhan

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-10-16 : 10:24:11
What do you say about this?

Invalid value 547 for state. Valid range is from 0 to 255


Too old to Rock'n'Roll too young to die.
Go to Top of Page

mohan123
Constraint Violating Yak Guru

252 Posts

Posted - 2012-10-17 : 01:46:48
Hey web fred

In table Type defind function i had extra parameter and i gave dummy ID's of reference tables.So thats the reason it shown error after some modifications it worked out well
declare @t_tUserMeasure tUserMeasure
insert into @t_tUserMeasure values(55,1,'quant','Testing','2012-07-20',1)

exec [usp_UserMeasure_MultiInsert]
@i_AppUserId = 23,
@i_PatientUserId = 214559,
@t_tUserMeasure = @t_tUserMeasure


P.V.P.MOhan
Go to Top of Page
   

- Advertisement -