Re: Parameters after "FROM" & "DROP"

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: J McDermond (nospam_at_hotmail.com)
Date: 07/21/04


Date: Wed, 21 Jul 2004 16:19:38 -0400

Thanks for the link Al. I solved my issues...sort of...

My sql runs fine in query analyzer, both parses and executes with no
problems. However, when placed in my execute sql task, it shoots up this
enigmatic error:
Error Source: Microsoft OLE DB Provider for SQL Server
Error Description: Could not find prepared statement with handle 1.

Anyone else ever encounter this error?

"Allan Mitchell" <allan@no-spam.sqldts.com> wrote in message
news:%23s2pgR1bEHA.1048@tk2msftngp13.phx.gbl...
> You would need to do this dynamically and the best article I can point you
> to is this one
>
> http://www.sommarskog.se/dynamic_sql.html
>
> --
> --
>
> 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
>
>
> "J McDermond" <nospam@hotmail.com> wrote in message
> news:2m7ri4Fjra6oU1@uni-berlin.de...
> > Hey all,
> >
> > First, if anyone would care to help me out in a post a few lines down
> > (subject is "can't use ? after FROM") I'd greatly appreciate it.
> >
> > But my main question is how does one dynamically set tablenames as
> > parameters after certain commands (alter, from, drop, etc...)? Is it
even
> > possible? I know I can't be the first to hit this barrier...
> >
> > For instance, a line in my execute sql task reads "DROP TABLE @TableVar"
> >
> > Naturally, it doesn't work. Suggestions anyone? Thanks.
> >
> >
>
>



Relevant Pages

  • Re: Tracing user & permissions (triggers and stored p)
    ... To solve my problem I chosed to configure the SQL ... > from xp_cmdshell executes under the security context of the SQL Server ... >> sql Trigger executes a Stored Procedure passing it some variables. ...
    (microsoft.public.sqlserver.security)
  • Execute SQL 2005 SSIS Packages
    ... Below is a function I used in the past that executes a SQL 2000 DTS job. ... I'm trying to find new vba code that can execute a SQL 2005 SSIS Package. ... Set oPKG = New DTS.Package ... Dim sServer As String, sUsername As String, sPassword As String ...
    (microsoft.public.access.formscoding)
  • Re: How to make C#.net Windows Service be programmed to run on only ac
    ... My Windows Service executes jobs (DTS or SQL serbver jobs) that are ... the passive node becomes active..and so on. ...
    (microsoft.public.dotnet.languages.csharp)
  • Why "Specified cast is not valid" error?
    ... I created a seperate "data" class to house all the MySQL connection and sql ... I have a method named "ExecuteAggregate" that takes in a sql string like ... builds without error or warning but the page errors out when it executes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Get ID after INSERT ASP.Net
    ... The following code executes the Insert correctly: ... I have an extremely quick example on parameterised commands with ADO .Net ... how you send SQL commands. ... Links for SQL Server Books Online: ...
    (microsoft.public.sqlserver.programming)