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 |
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-17 : 04:50:27
|
a |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-17 : 09:48:39
|
if you want column value you need to use dynamic sql for that. get name of column in a variable and append it to query as a string. then use EXEC or sp_executesql to execute it------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-17 : 10:47:00
|
quote: Originally posted by visakh16 if you want column value you need to use dynamic sql for that. get name of column in a variable and append it to query as a string. then use EXEC or sp_executesql to execute it------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
I am kinna confused. Do you have a sample? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-17 : 10:58:49
|
how is data present in unsaccountb table. does it have column storing name and another column storing value?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-17 : 16:23:04
|
quote: Originally posted by visakh16 how is data present in unsaccountb table. does it have column storing name and another column storing value?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
This is the problem area..As seen below, the query outputs the unsaccountB tbl column name instead of the unsaccountB tbl column value. "CanonicalName " is one of the column name in unsaccountB tbl not the value...dw.[OldValue] | newVal=FINSOFT/FINSOFT/Özlem Karaman | CanonicalNameAlso here is some data on unsaccountB tbl: |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-07-17 : 22:58:35
|
please post within code tags when you give some data. otherwise its quite difficult to find out the column names with values------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
emmim44
Yak Posting Veteran
65 Posts |
Posted - 2012-07-18 : 05:08:40
|
quote: Originally posted by visakh16 please post within code tags when you give some data. otherwise its quite difficult to find out the column names with values------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
It is already between "code" tags... |
|
|
|
|
|