Please Help me, Please Help me

Please Help me, Please Help me

Post by Tomas Polanc » Mon, 03 Feb 1997 04:00:00



Please help,
I have a real problem with  SQL 6.0 and SQL 6.5 not  recognize a creation
of an index in a  temporary table when done inside a stored procedure only.
It is okay when done outside in the query window using GO.

try this experiment and you will understand what I am saying.

in the query window type
select * into #temp1 from sysindexes
go
create index temp1_index on #temp1(id)
go
select * from #temp1(index=temp1_index)
go

The above code will run fine.

try to put the code inside a sp, without the go
and run it,
it will give you the following error
Msg 308, Level 16, State 1
Index 'temp1_index ' on table '#temp1' (specified in the FROM clause) does
not exist.

I need to find an answer to my problem, or a work around it
Thank you for hep
Tomas S Polanco
Sanpoco Computer System

 
 
 

Please Help me, Please Help me

Post by Kalen Delane » Mon, 03 Feb 1997 04:00:00


A stored procedure is compiled as a single batch before anything is
executed, so when the second select is compiled, the index has not been
created yet. You can circumvent this by running the second select in its
own batch, using the dynamic execute:

select * into #temp1 ....
create index ....
exec ('select * from #temp1(index=temp1_index)')

Hope this helps!
Kalen Delaney



> Please help,
> I have a real problem with  SQL 6.0 and SQL 6.5 not  recognize a creation
> of an index in a  temporary table when done inside a stored procedure
only.
> It is okay when done outside in the query window using GO.

> try this experiment and you will understand what I am saying.

> in the query window type
> select * into #temp1 from sysindexes
> go
> create index temp1_index on #temp1(id)
> go
> select * from #temp1(index=temp1_index)
> go

> The above code will run fine.

> try to put the code inside a sp, without the go
> and run it,
> it will give you the following error
> Msg 308, Level 16, State 1
> Index 'temp1_index ' on table '#temp1' (specified in the FROM clause)
does
> not exist.

> I need to find an answer to my problem, or a work around it
> Thank you for hep
> Tomas S Polanco
> Sanpoco Computer System



 
 
 

1. COMBO BOX, PLEASE HELP, PLEASE HELP, PLEASE HELP!

From:

Organization:
              The University of Iowa
 Newsgroups:
              comp.databases.xbase.fox

I'm using VFP 3.0 for Mac and want to design a form with combo
boxes. Everything seems fine but after I checked any item on
any drop-down list there is nothing to appear in the box itself.
In other words, I can see the list and check any item, but
nothing shows up in the filled box. I designed these combo
boxes using combo box builder and every step seems correct.
I would like to hear from anyone regarding this problem. I
want to express my sincere thanks for your kind help in
advance.

Fang Qian

2. FileMaker Pro Server Mac -> NT Server

3. emergency please help me please please please

4. Point of Sale in FOXP

5. APPROACH QUERY-PLEASE PLEASE PLEASE PLEASE HELP

6. VB6 & ADO2.5: Need to copy data from one ADO Recordset to another, slightly different one, and persist it.

7. Please, Please, Please I need help working with dates

8. mySQL Dates...

9. Please, please, please help!!

10. Cloning problem -- please please please help

11. immdiate help now please please please

12. character-2-ascii conversion please please please help !

13. PLEASE PLEASE PLEASE Help Me!!!