473,473 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

I can't create a temp table

1 New Member
Hi everyone,

I saw a post of this, but i still can't solve it.
This is what i got:
SET @sql = 'CREATE TABLE #SIAG_MatrizTemporal ....'
EXEC(@sql)

this seems to work fine, but if i try to make a query on #SIAG_MatrizTemporal, the table doesn't exists, the error says: "Invalid object name '#SIAG_MatrizTemporal'."

If I add to @sql a select statement the values are in there, but if i do it outside the same string, it just doesn't work.

Joseph Weinstein says that i should add "selectMode=cursor" where should i add it ?? I'm just working with the stored procedure, i'm not using VS, Java or any other programming language. Later i have to use it from SQL Reporting Services, but first i have to make it work from the Query Analyzer...

I think i have to activate or desactivate some property on the Server or the query, but i was looking in Internet and nothing... I really need to solve this, and i can´t find anything that works.

If anyone can help me, i really appreciate it.
Thanks in advance :)

Joan
Aug 16 '06 #1
1 2507
trams
1 New Member
SET @sql = 'CREATE TABLE ##SIAG_MatrizTemporal ....'
EXEC(@sql)

You can use ##SIAG_MatrizTemporal to Dispose.
我不懂英文!
这里你必须使用全局临时表。
follow is my code. ex:

IF EXISTS
(SELECT * FROM tempdb..sysobjects WHERE name LIKE '##fabtemp%')
DROP TABLE ##fabtemp

EXEC ('
SELECT GUID=NEWID(),MstGUID = ''' + @MstGUID + ''',
iNumber = IDENTITY(int, 1,1),
sRollNo,MaterialGUID,sLotNo,
sStoragePlaceCD,sStkTypeCD,
sSupplySourceCD,
fAccountQty = fOnHandQty + fOnHoldQty,
fRealQty = fOnHandQty + fOnHoldQty,fProfitOrLossQty = 0,
sCtUid = ''' + @sUserID + ''',
dCtDate = GETDATE() INTO ##fabtemp
FROM IMFabricRollStock
WHERE sStorageCD = ''' + @sStorageCD + '''' + @sCondition +
'ORDER BY sStoragePlaceCD ')

/*--------------------------------------------------------
--------------------------------------------------------*/

INSERT INTO imFabricCheckingDtl
SELECT * FROM ##fabtemp
Aug 17 '06 #2

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

Similar topics

6
by: dev | last post by:
how create a temp table as a copy of a existing table and then update1 field and insert the hole temp table back in the existing table? please any help? if i have 10 fields in 1 record and...
4
by: Yossi Naggar | last post by:
Hello to everyone, I am an experienced user in MSSQL Server. Lately I have been started using MySQL. I managed to create my database and tables. When I wanted to execute the following query:...
1
by: Sergio | last post by:
Hi all! I have a problem with a temp table. I start creating my table: bdsqlado.execute ("CREATE TABLE #MyTable ...") There is no error. The sql string has been tested and when it's executed...
1
by: Liya | last post by:
I'm trying to create a temp table in the stored procedure. the syntex is the following: create st_proc variables declared if something >0 create temp table #Table1
9
by: Vorpal | last post by:
Here is a small sample of data from a table of about 500 rows (Using MSSqlserver 2000) EntryTime Speed Gross Net ------------------ ----- ----- 21:09:13.310 0 0 0 21:09:19.370 9000 ...
3
by: Wiggy | last post by:
Hi, It's probably easiest if I describe what I'm trying to do: I have several tables I want to base a query on. In addition I have some dynamic data that I want to join against that consists...
17
by: Jon Ole Hedne | last post by:
I have worked on this problem some hours now (read many-many...), and I can't solve it: In vba-code I create a table with Connection.Execute, and add some data to it. This table is saved in the...
1
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...
7
by: John | last post by:
Hi, How do websites like google page through large numbers of records? For example; if I do a search on Google, get 187,000 matches, and go to the 22nd page of the results; I'm sure Google...
2
by: lenygold via DBMonster.com | last post by:
Hi everybody! I have a UDF. It is working fine. But when i try apply the same UDF to a view it is not working. CREATE VIEW SSN_SORTED AS WITH...
0
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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
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
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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.