dbTalk Databases Forums  

Create Table not found in same Execute SQL

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Create Table not found in same Execute SQL in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ron Sissons
 
Posts: n/a

Default Create Table not found in same Execute SQL - 08-19-2004 , 10:23 AM






I have an Execute SQL task that creates a table (if it doesn't exist) and then i use a cursor to populate the table.
Problem is the insert fails because it says the table wasn't found. How is that possible when it was just created in the statement above the insert? Does the connection have to be refreshed, or do I need to create the table in a separate task, then do the insert in another on success of the create table?

Ron Sissons, DBA
Information Technology Services
Riverside County Office of Education
3939 Thirteenth Street, Riverside, CA 92502-0868
Telephone: (909) 826-6471; FAX: [909] 826-6451


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Create Table not found in same Execute SQL - 08-19-2004 , 03:52 PM






I know there has to be a reason you are using a cursor over straight TSQL or
a DataPump. :-)

You should be able to create a table and then populate the table in the same
task. i.e.

CREATE TABLE DeleteMePlease(A int)
GO
INSERT DeleteMePlease(A) VALUES(1)


If you hit parse it will tell you that it has no idea about the table but it
works at execution time.



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


"Ron Sissons" <RSISSONS (AT) rcoe (DOT) k12.ca.us> wrote

I have an Execute SQL task that creates a table (if it doesn't exist) and
then i use a cursor to populate the table.
Problem is the insert fails because it says the table wasn't found. How is
that possible when it was just created in the statement above the insert?
Does the connection have to be refreshed, or do I need to create the table
in a separate task, then do the insert in another on success of the create
table?

Ron Sissons, DBA
Information Technology Services
Riverside County Office of Education
3939 Thirteenth Street, Riverside, CA 92502-0868
Telephone: (909) 826-6471; FAX: [909] 826-6451



----------------------------------------------------------------------------
----


I have an Execute SQL task that creates a table (if it doesn't exist) and
then i use a cursor to populate the table.
Problem is the insert fails because it says the table wasn't found. How is
that possible when it was just created in the statement above the insert?
Does the connection have to be refreshed, or do I need to create the table
in a separate task, then do the insert in another on success of the create
table?

Ron Sissons, DBA
Information Technology Services
Riverside County Office of Education
3939 Thirteenth Street, Riverside, CA 92502-0868
Telephone: (909) 826-6471; FAX: [909] 826-6451



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.