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 |
|
rajpes
Starting Member
13 Posts |
Posted - 2010-02-11 : 09:26:01
|
| declare @var nvarchar(50)set @var='2+2+2' i want to displat 6 which is sum of 2+2+2(without splitting the character!)--actually when we say just run" select 2+2+2 "it shows 6how do i do this |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-11 : 09:27:42
|
| you can do like EXEC('select ' + @var)but question is why do want to do this?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
rajpes
Starting Member
13 Posts |
Posted - 2010-02-11 : 09:36:16
|
quote: Originally posted by visakh16 you can do like EXEC('select ' + @var)but question is why do want to do this?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
thank you, but still i m having problemi have a varchar column which has values like '1+1+1' , '5+4+1' e.t.ci want to create a new column inselect and display the value corresponding to it.How do i do thisselect col1,exec col1 as col2? |
 |
|
|
rajpes
Starting Member
13 Posts |
Posted - 2010-02-11 : 09:52:43
|
| plz reply |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|