Tested with your sample string:
CREATE FUNCTION fn_PARM (@Parm nvarchar(2000))
RETURNS @TParm TABLE (City_Name nvarchar(100),State nvarchar(100),Zipcode nvarchar(100),Country nvarchar(100))
AS
BEGIN
DECLARE @City_Name nvarchar(100)
,@State nvarchar(100)
,@Zipcode nvarchar(100)
,@Country nvarchar(100)
,@CommaPosition1 tinyint
,@CommaPosition2 tinyint
SELECT @CommaPosition1 = charindex(',',@Parm)
IF (@CommaPosition1>0)
BEGIN
SELECT @City_Name = ltrim(rtrim(SUBSTRING(@Parm,1,@CommaPosition1 - 1)))
SELECT @CommaPosition2 = @CommaPosition1 + 1
SELECT @CommaPosition1 = charindex(',',@Parm,@CommaPosition2)
IF (@CommaPosition1>0)
BEGIN
SELECT @State = ltrim(rtrim(SUBSTRING(@Parm,@CommaPosition2 + 1,@CommaPosition1 - (@CommaPosition2 + 1))))
SELECT @CommaPosition2 = @CommaPosition1 + 1
SELECT @CommaPosition1 = charindex(',',@Parm,@CommaPosition2)
IF (@CommaPosition1>0)
BEGIN
SELECT @Zipcode = ltrim(rtrim(SUBSTRING(@Parm,@CommaPosition2 + 1,@CommaPosition1 - (@CommaPosition2 + 1))))
SELECT @Country = ltrim(rtrim(SUBSTRING(@Parm,@CommaPosition1 + 1,LEN(@Parm))))
END
END
END
INSERT INTO @TParm (City_Name, State, Zipcode,Country)
VALUES (@City_Name, @State, @Zipcode, @Country)
RETURN
END
GO
Simple usage:
select * from fn_PARM('Delhi , Delhi ,34567 ,IND' )
For use in a query, see This MSDN article about using APPLY.