Make Apostrophe in SQL Query
declare @str varchar(50)
select @str = 'ABC'''
declare @strLen int = len(@str)
declare @rtnText varchar(50)
select @rtnText = ''
if @strLen > 0
begin
declare @i int = 0
while @i <= @strLen
begin
select @rtnText = @rtnText + substring(@str,@i,1)
if substring(@str,@i,1) = ''''
select @rtnText = @rtnText + ''''
set @i = @i + 1
end
end
print @rtnText
declare @str varchar(50)
select @str = 'ABC'''
declare @strLen int = len(@str)
declare @rtnText varchar(50)
select @rtnText = ''
if @strLen > 0
begin
declare @i int = 0
while @i <= @strLen
begin
select @rtnText = @rtnText + substring(@str,@i,1)
if substring(@str,@i,1) = ''''
select @rtnText = @rtnText + ''''
set @i = @i + 1
end
end
print @rtnText
0 Comments:
Post a Comment
Thanks a lot.
Subscribe to Post Comments [Atom]
<< Home