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 |
|
JCirocco
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-09-04 : 16:33:40
|
| I have an odd situation where I need to get a calculated field that is totally unavailable to a normal query. What I believe I need to do (and should learn how anyway) is the ability to select data and write to a temp table that I can then retrieve in a join.Does anyone have a simple example of something that is straight forward and works (conceptually at least).I am learning that the MSDN.Microsoft.com online books leave a lot to be desired...John"The smoke monster is just the Others doing barbecue" |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-09-04 : 17:12:35
|
"I need to get a calculated field that is totally unavailable to a normal query"Didn't get that.Can you explain more clear please? No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
gavakie
Posting Yak Master
221 Posts |
Posted - 2009-09-04 : 17:23:05
|
| Im not sure exactly what you mean but something like this.Select column1, column2, column3From tableInto #tttempSelect *From #tttemp t1Inner Join on Table1 t2 on t1.column = t2.columnDrop #ttTemp |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-09-05 : 06:16:11
|
quote: Originally posted by JCirocco I have an odd situation where I need to get a calculated field that is totally unavailable to a normal query. What I believe I need to do (and should learn how anyway) is the ability to select data and write to a temp table that I can then retrieve in a join.Does anyone have a simple example of something that is straight forward and works (conceptually at least).I am learning that the MSDN.Microsoft.com online books leave a lot to be desired...John"The smoke monster is just the Others doing barbecue"
you need to be more specific. can you post details in below format please?http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
JCirocco
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-09-05 : 13:29:15
|
| Exactly what gavakie had was perfect. My problem is I don't have details, just an idea of what I think I need to do to solve a reporting services problem. I was given explicit orders for a particular report that needed dynamic number of columns across and dependent calcs down the rows. If you are familiar with reporting services it is a classic example of a matrix type report except the "data" rows included unlike data. First 4 rows were easy Unions of select statements but the last is a calculated field that needs the sums of 2 of the first 3 select statement. I have never done the temp write to db and just needed an example.I will try in future to give more info but thanks to all for the help!John"The smoke monster is just the Others doing barbecue" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-09-06 : 13:48:53
|
| i cant see any calculated members being used in posted solution. |
 |
|
|
JCirocco
Constraint Violating Yak Guru
392 Posts |
Posted - 2009-09-06 : 19:28:02
|
| Sorry but I know how to do the t1.dailytotal/t2.monthlyaverage part. I had never done the temp table select/write/use/drop part... Sorry if I was not clearer.John"The smoke monster is just the Others doing barbecue" |
 |
|
|
|
|
|