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 |
|
srxr9
Starting Member
15 Posts |
Posted - 2006-09-25 : 12:53:24
|
| declare @Id integerset @Id=1145select '@'+'Id'result: @IdBut I want the result to be 1145. Is it possible, If so please let me know how.ThanksSuresh |
|
|
snSQL
Master Smack Fu Yak Hacker
1837 Posts |
Posted - 2006-09-25 : 12:55:02
|
| [code]declare @Id intset @Id=1145select @Id[/code] |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2006-09-25 : 13:22:19
|
| Is your question that you want to build local variables dynamically? You would need to use dynamic sql for that. There is probably a standard technique already devised for whatever your objective is if you want to tell us what that is. :)Be One with the OptimizerTG |
 |
|
|
srxr9
Starting Member
15 Posts |
Posted - 2006-09-25 : 13:51:19
|
| Yes, I am trying to build a dynamic query.I have a variable that returns 'Id'and there is already a variable declared as @Id.I am trying to retrieve the value of @Id using the variable that returns 'ID'For example:declare @Id integerset @Id=1145declare @Id1 varchar(10)set @Id1 = 'ID'select '@'+@Id1result: @IDbut I want it as 1145.ThanksSuresh |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-09-25 : 14:07:02
|
| What is it you are trying to accomplish? I can't really tell from the code you posted.CODO ERGO SUM |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|