Sql server

 Store procedure to get names(menu name) of id's(menu id's)  which are separated by comma in a  single column in the table.



declare @str nvarchar(max)
declare @int int
set @int=1
select @str=(select Replace(ColumnName,',','') from tbl_Name where ID=8)---It will gives 1532 id of menu link
declare @len int
set @len=len(@str)
while @int<=@len
Begin
select * from tbl_TableName where ID=SUBSTRING(@str,@int,1)----gives name of menu link by id 
set @int=@int+1
ENd

output

No comments:

Post a Comment