Wykorzystanie LOCATE i REGEXP

SELECT LOCATE( ' ', address ) pos, address, SUBSTRING_INDEX(address, ' ', -1), address REGEXP '[:digit:]' FROM hotele
SELECT LOCATE( ' ', address ) pos, address, SUBSTRING_INDEX( address, ' ', -1 ) , address REGEXP '[[:digit:]]' FROM hotele
SELECT LOCATE( ' ', address ) pos, address, SUBSTRING_INDEX( address, ' ', -1 ) , address REGEXP '[[:digit:]]' FROM hotele WHERE SUBSTRING_INDEX( address, ' ', -1 ) REGEXP '[[:digit:]]'
update hotele set nr_domu = SUBSTRING_INDEX( address, ' ', -1 ) WHERE SUBSTRING_INDEX( address, ' ', -1 ) REGEXP '[[:digit:]]'
SELECT LOCATE( ' ', REVERSE(address) ) pos, address, trim(SUBSTRING( address, 1, LENGTH(address) - LOCATE( ' ', REVERSE(address) ))) FROM hotele WHERE SUBSTRING_INDEX( address, ' ', -1 ) REGEXP '[[:digit:]]'
update hotele set ulica = trim(SUBSTRING( address, 1, LENGTH(address) - LOCATE( ' ', REVERSE(address) ))) WHERE SUBSTRING_INDEX( address, ' ', -1 ) REGEXP '[[:digit:]]'

Prosty sposób na katakanę w sql

insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ź%'
insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ż%'
insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ą%'
insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ł%'
insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ś%'
insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ń%'
insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ć%'
insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ó%'
insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ą%'
insert into slo_pl(id, slowo) select id,slowo from slo where slowo like '%ę%'
update slo_pl set slowo=replace(slowo,'ź','z')
update slo_pl set slowo=replace(slowo,'ż','z')
update slo_pl set slowo=replace(slowo,'ą','a')
update slo_pl set slowo=replace(slowo,'ł','l')
update slo_pl set slowo=replace(slowo,'ś','s')
update slo_pl set slowo=replace(slowo,'ń','n')
update slo_pl set slowo=replace(slowo,'ć','c')
update slo_pl set slowo=replace(slowo,'ó','o')
update slo_pl set slowo=replace(slowo,'ę','e')

Prosty kursor w SQL


declare @nr nvarchar(255)
declare @id_zamowienie int
declare @status nvarchar(255)
SET @nr = '2281887'
DECLARE wynik CURSOR FOR
select id_zamowienie, status from ZAMOWIENIE where nr_druku = @nr
OPEN wynik
FETCH NEXT FROM wynik INTO @id_zamowienie, @status
CLOSE wynik
DEALLOCATE wynik