Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
raghuveer125
Constraint Violating Yak Guru
285 Posts |
Posted - 2011-04-01 : 06:43:39
|
| create table #a (id int)insert into #a values (1)Declare @a varchar(25),@b nvarchar(25) ,@C nvarchar (25)set @C='id'set @a='Select '+@C+' from #a'exec(@a)How to store this @a result in other variable @b I dont need to create temp tableRaghu' S |
|
|
raghuveer125
Constraint Violating Yak Guru
285 Posts |
Posted - 2011-04-01 : 08:20:02
|
| Ok friends I got solution for thiscreate table #t(id int)insert into #t values(1)declare @j varchar(5),@v intset @j='id'declare @t table (col varchar(5))insert into @t exec ('select '+ @j +' from #t')select @v=col from @tselect @vRaghu' S |
 |
|
|
|
|
|