-
Just want last name
I have the following name in a column:
jane m doe
I want to remove everything and update the row to look like:
doe
Can someone help me? Thanks.
-
Just want last name (reply)
create this function and execute update statement on that table.
--select dbo.lastname("Muthusamy Anantha Kumar"
create function dbo.lastname (@string varchar(100))
returns varchar(100)
as
begin
declare @len int
declare @count int
set @len= len(rtrim(@string))
set @count = @len
while @count >=0
begin
if substring(@string,@count,1) = " "
begin
break
end
set @count = @count-1
end
return right(@string,@len-@count)
end
------------
charles at 8/20/2002 12:14:02 PM
I have the following name in a column:
jane m doe
I want to remove everything and update the row to look like:
doe
Can someone help me? Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|