| Author: Shankar 23 Nov 2008 | Member Level: Diamond | Rating:  Points: 5 |
Hi Gaurav,
Pls use the below code
declare @pptitle as varchar(20) create table temp(Name varchar(50)) -- drop table temp declare cur cursor for select distinct(CategoryName) from dbo.Categories open cur fetch next from cur into @pptitle WHILE @@FETCH_STATUS = 0 BEGIN print @pptitle exec('alter table temp add ' + @pptitle + ' varchar(50)') fetch next from cur into @pptitle end close cur deallocate cur
Thanks A S
If u need any clarifications pls mail me.
Thanks and Regards, A S.
Note - Don't forget to rate this response [Poor / Fine / Good / Great / Excellent]
|