View previous topic :: View next topic
|
Author |
Message |
raman.k
New User
Joined: 26 Feb 2007 Posts: 24 Location: chennai
|
|
|
|
hi
I have one question in DB2. I have table name is EMP. it have emp_name field. now i want display emp_name in first 5 character only
how is it position please tell me |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You could define a new working-storage variable called ws-emp_name and give it a picture of x(5). |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Isn't there a "substring" command? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Yup, but i don't think it can be used in SQL . . .
Becomes a matter of defining the "short" field or using the substring/reference modification each time the "sort" valueis needed. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
DB2:
SUBSTR(string-expression,start[,length])
where [...] is optional |
|
Back to top |
|
|
|