hi,
i had a problem with the code below
OPEN @hCursOne
FETCH NEXT FROM @hCursOne INTO @sSurname, @sMemDet, @nIndNo, @sCont
WHILE @@FETCH_STATUS = 0
BEGIN
SET @regno = @regno + 17
INSERT INTO newiuser
(registration_no, password, prompt_question, prompt_answer, individual_ref, status, valid_from, create_timestamp, update_timestamp, created_by, updated_by)
VALUES
(@regno, @sSurname, 'What's his/her name?', @sCont, @nIndNo, @olsstatus, GETDATE(), GETDATE(), GETDATE(), suser_sname(), suser_sname())
FETCH NEXT FROM @hSqlOne INTO @sSurname, @sMemDet, @nIndNo, @sCont
END
CLOSE @hCursOne
it was giving truncating errors and it was not an issue of the column size, so i attempted to print out the values of the variables with
print @nIndNo +' '+@sSurname +' '+@sMemDet+' '+@sCont
and got this error
'Server: Msg 245, Level 16, State 1, Line 39
Syntax error converting the varchar value 'vurata tol' to a column of data type int.
when i tried to print values of each variable independent of each other, there were no errors, and the same for when i attempt printing values of
@sSurname +' '+@sMemDet+' '+@sCont
when i include @nIndNo
the same error comes up.
I didn't write this script from scratch, i modified it to suit the present purpose.
does anyone have an idea why this happens?
i had a problem with the code below
OPEN @hCursOne
FETCH NEXT FROM @hCursOne INTO @sSurname, @sMemDet, @nIndNo, @sCont
WHILE @@FETCH_STATUS = 0
BEGIN
SET @regno = @regno + 17
INSERT INTO newiuser
(registration_no, password, prompt_question, prompt_answer, individual_ref, status, valid_from, create_timestamp, update_timestamp, created_by, updated_by)
VALUES
(@regno, @sSurname, 'What's his/her name?', @sCont, @nIndNo, @olsstatus, GETDATE(), GETDATE(), GETDATE(), suser_sname(), suser_sname())
FETCH NEXT FROM @hSqlOne INTO @sSurname, @sMemDet, @nIndNo, @sCont
END
CLOSE @hCursOne
it was giving truncating errors and it was not an issue of the column size, so i attempted to print out the values of the variables with
print @nIndNo +' '+@sSurname +' '+@sMemDet+' '+@sCont
and got this error
'Server: Msg 245, Level 16, State 1, Line 39
Syntax error converting the varchar value 'vurata tol' to a column of data type int.
when i tried to print values of each variable independent of each other, there were no errors, and the same for when i attempt printing values of
@sSurname +' '+@sMemDet+' '+@sCont
when i include @nIndNo
the same error comes up.
I didn't write this script from scratch, i modified it to suit the present purpose.
does anyone have an idea why this happens?