I need to write a program to transfer 2 sentences into pig latin. for example: he left today. -- ehay eftlay odaytay.
Please help i can only get so much
Not sure if this is what you are looking for
because it is written for SQL SERVER 7.0,
but you might be able to modify it!?!
CREATE PROCEDURE spP_L
(@phrase varchar(1000))
AS
set nocount on
declare @array varchar(1000) /* sentance passed from Call of sp_*/
declare @separator char(1)
declare @separator_position int /*used to locate each separator charachter*/
declare @array_value varchar(1000) /*holds each array value as it is returned*/
declare @PigTranslator varchar(1000) /*holds return of each returned array to return one(1) sentance)*/
set @separator=' ' /*Setting separator to the 'space' between words*/
set @array = @phrase + @separator
set @PigTranslator=''
while patindex('%' + @separator + '%', @array)<>0
begin
select @separator_position = patindex('%' + @separator + '%', @array)
select @array_value = left(@array, @separator_position -1)
set @PigTranslator =@PigTranslator+' '+substring(@array_Value,2,(len(@array_VAlue)-1))+substring(@array_Value,1,1)+'ay'
select @array = stuff(@array, 1, @separator_position, '')
end
Select @PigTranslator
set nocount off
/* Original Parsing sp_ created by graz@sqlteam.com
'Pig Latin' modifications made by mGruodis@aol.com*/
hope this helps,
Michael
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.