473,508 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

variables and temp table data

80 New Member
I'm trying to pull data into a variable from a temp table. ending up with "The column prefix '#NextCenter' does not match with a table name or alias name used in the query." I know this must be easier than I'm making it, but I can't seem to get it.

Select Top 1 Table.FieldName into #NextCenter
from Table Inner Join Table2 on Table.Key = Table2.key
where Table.Completed = 0 and Table.OtherField = '00000'

Declare @testvar as varchar(60)

Set @testvar=#NextCenter.CostCenterDescription

So if this is not the right syntax, how to I set a variable equal to a field value?
Oct 12 '07 #1
1 1222
iburyak
1,017 Recognized Expert Top Contributor
Change this:

Expand|Select|Wrap|Line Numbers
  1. Set @testvar=#NextCenter.CostCenterDescription
to this:

Expand|Select|Wrap|Line Numbers
  1. Select @testvar = CostCenterDescription from #NextCenter
Good Luck.
Oct 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
6390
by: Rick Hein | last post by:
I have an application that I am working on that uses some small temp tables. I am considering moving them to Table Variables - Would this be a performance enhancement? Some background...
7
1413
by: Jan Bernatik | last post by:
Hi I have a function called from another one, which runs in loop, so that is it called very often something like this: void my_function(int x) { int temp; temp = x * some_const;
2
2011
by: PaJeeper | last post by:
I'm trying to write code that will automatically add a specified number of records to a table using variables derived from queries. I am attempting to do this with DAO. Background. I have...
1
2879
by: Robert McEuen | last post by:
Using Access 97 on WinXP I have data in a DB2 table that I'm trying to get into an identical table in my backend db. Based on volume of data and frequency of download, I'm trying to avoid...
9
3169
by: Randy | last post by:
Hello, I'm having a strange problem. I've got a .NET web app which uses Session variables. Sometime, not all the time, they get cross threaded...that is...one user will have another user's Session...
4
4450
by: Matt Jensen | last post by:
Howdy I've got a rather strange issue occuring. I used forms based .NET authentication, although I'm also setting some session variables when people login. However, I've found when people use...
1
4453
by: serge | last post by:
I am running SQL Server Best Practices on a SQL 2000 database and it is recommending me to change the temp tables inside SPs to table variables. I had read already in other places to use table...
16
10296
by: pukivruki | last post by:
hi, I wish to create a temporary table who's name is dynamic based on the argument. ALTER PROCEDURE . @PID1 VARCHAR(50), @PID2 VARCHAR(50), @TICKET VARCHAR(20)
2
2099
by: justplain.kzn | last post by:
Hi, I have a table with dynamic html that contains drop down select lists and readonly text boxes. Dynamic calculations are done on change of a value in one of the drop down select lists. ...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7120
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7323
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.