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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 DELETE LAST 2 CHARACTERS FROM COLUMN

Author  Topic 

james_w
Starting Member

21 Posts

Posted - 2004-07-14 : 09:54:49
I have a column of postcodes which i need to convert to postal sectors.
e.g:

DA9 9HL
DA9 9AT
DA10 0BW
DA10 0JY
DA9 9HF

to convert these to postal sectors i need to show all except the last 2 characters in the field. I can get it to show the first 5 or 6 characters but because the postcodes have a varying amount of characters it is not correct.

e.g:

DA9 9
DA9 9
DA10 0
DA10 0
DA9 9

Can anyone help with this please it's driving me mad.

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-07-14 : 10:25:32
Select left(postCode,len(postCode)-2)

Corey
Go to Top of Page

james_w
Starting Member

21 Posts

Posted - 2004-07-14 : 10:37:19
Thanks Corey, it's working fine.

I appreciate your help...James.
Go to Top of Page
   

- Advertisement -