DELETE part of string record and update

User avatar
sal21
PlatinumLounger
Posts: 4354
Joined: 26 Apr 2010, 17:36

DELETE part of string record and update

Post by sal21 »

I need to update the related NR from STRADA with a split part of fleld STRADA and delete the splitted part from STRADA...
I hope all is clear.
My test sql but dont work:

UPDATE STRADE SET STRADE.NR=SPLIT([STRADE].[STRADA],", ")(1);

And delete the part splitted from STrada

in effect i nned to divede street and number of street

note:
all filed are text.
Not possible other comma in the part of strng STRADA filed

to the and of query, for first record:

STRADA NR
VIA GIUSEPPE CESARE ABBA 8
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78457
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: DELETE part of string record and update

Post by HansV »

UPDATE STRADE SET NR=TRIM(MID(STRADA,InStr(STRADA,',')+1)), STRADA=LEFT(STRADA,InStr(STRADA,',')-1)
Best wishes,
Hans