Groups | Blog | Home
all groups > sql server programming > december 2004 >

sql server programming : single update query


SubramanianRamesh
12/2/2004 11:03:02 PM
hi
i have two tables
items
student code name
1 null book
2 null book
3 null pen
..
..
going
anothr table
item_type

name code

book code1
pen code2

now i want to update table item colmn code is item_type code

i used this query

UPDATE items
SET code = it.code
FROM items i ,item_type it
WHERE i.name = it.name
this query return error

String or binary data would be truncated.
The statement has been terminated.

thanks in advance
Robert Davis
12/2/2004 11:19:01 PM
The code column in the items table is smaller than the number of characters
in the codes in the code column of the item_tepe table.

Also, you don't want to join on text values. Your Code should be an integer,
preferably an identity field.

Robert.

[quoted text, click to view]
AddThis Social Bookmark Button