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.
Author |
Topic |
ori_davidson
Starting Member
15 Posts |
Posted - 2014-09-28 : 06:04:16
|
that's the query:update uset u.jrnlmemo=d.CardNamefrom oinv u inner join OCRD d on u.CardCode = d.CardCode where d.QryGroup45 ='Y' or d.GroupCode =119 or d.GroupCode =108I am getting this ERROR:Msg 8152, Level 16, State 13, Line 1String or binary data would be truncated.The statement has been terminated.THANKS,ORI |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-09-28 : 07:53:42
|
Card name is longer than jrnlmemo |
|
|
ori_davidson
Starting Member
15 Posts |
Posted - 2014-09-28 : 08:11:18
|
i guess i need the function CAST - how do I use it here?THANK YOU VERY MUCH |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-09-28 : 17:34:51
|
You may or may not need to CAST the column. It depends on the datatype. Can you please post CREATE TABLE commands for both tables in the query? |
|
|
ori_davidson
Starting Member
15 Posts |
Posted - 2014-09-29 : 00:18:15
|
is it possible to set only 10 char. in the OCRD table, I don't need the whole name. |
|
|
ori_davidson
Starting Member
15 Posts |
Posted - 2014-09-29 : 03:48:03
|
Hi again, can I write something like :LINE 2: set u.jrnlmemo= cast(d.CardName as char(10))I'm doing something wrong because - Its not working...update uset u.jrnlmemo=d.CardNamefrom oinv u inner join OCRD d on u.CardCode = d.CardCode where d.QryGroup45 ='Y' or d.GroupCode =119 or d.GroupCode =108 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2014-09-29 : 04:07:10
|
Basically you need to match the length of CardName to jrnlmemo. Using substring() will be more appropriate if both the columns have same datatypes.update uset u.jrnlmemo= substring(d.CardName,1,10)... Harsh Athalyehttp://in.linkedin.com/in/harshathalye/ |
|
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2014-09-29 : 09:37:57
|
again, please post the CREATE TABLE statements for the tables involved in the query |
|
|
ori_davidson
Starting Member
15 Posts |
Posted - 2014-09-29 : 09:46:01
|
WORKED!!!THANX!! |
|
|
|
|
|