August 18, 2005 at 4:42 am
Hi All,
Please give me sugestion coz I'm about to go crazy ..
I pass some value using vb.net and using the profiler I can see that all value that are passed through, the parameters are there(so Vb.net is OK). However, the result of the execution, one of the column's data is truncated to one letter only.
I tried to copy and paste the execution that were run (from profiler) and run it as normal query, it is also truncated.
But where I do normal UPDATE statement using normal query, the data would be inserted correctly.
please please shed some light !
The store procedure is
CREATE PROCEDURE UpdateCheckOut
@userindexnow int,
@outtime smalldatetime,
@outreason varchar
AS
Update CheckInTable
set timeout = @outtime,
alasanpulang = @outreason
where indexonly = @userindexnow
The event in Profiler would be
exec UpdateCheckOut @userindexnow = '70', @outtime = '8/18/2005 4:51:21 PM', @outreason = 'sick'
But in the table after the query is ran, everything would be correct but the alasanpulang (the column to be filled with 'sick') only resulted with letter s
which is the first letter of the @outreason parameter.
August 18, 2005 at 5:37 am
I have found (personal experience) that when you declare a variable as VARCHAR() without telling it HOW LONG then it will DEFAULT to VARCHAR(1).
Try telling the system how long you want the VARCHAR(i.e. how wide is the column) and try re-running the code.
Good Hunting!
AJ Ahrens
webmaster@kritter.net
August 18, 2005 at 6:27 am
yup all variables [n][var]char default to 1 when no lenght is specified.
August 18, 2005 at 9:04 pm
YESS !!!!!!
that's right !!!!!!
Now it works Thank you very much people ! I really appreciate the help
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy