RE: Using 'Execute SQL Task' to insert rows



Foss, I read your question and I don't see the subquery in the example you
have provided. Please elaborate. Cheers.

"Foss" wrote:

> Hi there all,
>
> I'm trying to insert a number of rows into a table using the results of a
> sub-query to populate them.
> They're both on the same connection.
>
> When I parse this, it's fine. When I execute it, I get this message:
> "Error Source : Microsoft OLE DB Provider for SQL Server'
>
> Error Description : The statement has been terminated.
> Subquery returned more than 1 value. This is not permitted when the subquery
> follows =, !=, <, <=, >, >= or when the subquery is used as an expression."
>
> What am I doing wrong?!
> Here's my SQL statement:
>
> ----------------------------------------
> INSERT INTO dbo.ExportUpdates
> (exup_collisionID, exup_addedat)
> SELECT DISTINCT col_id, GETDATE() AS CurrDate
> FROM dbo.Collisions
> ----------------------------------------
>
> I'm going quite mad looking at this so any help would be much appreciated!
>
> Cheers,
> Foss
.



Relevant Pages

  • Re: Using Execute SQL Task to insert rows
    ... The parse will only tell you that the query is not syntactically rubbish ... What the runtime is telling you is that in your subquery you have said ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ... > Here's my SQL statement: ...
    (microsoft.public.sqlserver.dts)
  • RE: Using Execute SQL Task to insert rows
    ... Sorry, I'm very new to all this, when I said subquery I was referring to the ... Pete ... "frank chang" wrote: ... > Foss, I read your question and I don't see the subquery in the example you ...
    (microsoft.public.sqlserver.dts)
  • Re: Using Execute SQL Task to insert rows
    ... "Foss" wrote: ... >> What the runtime is telling you is that in your subquery you have said ... >> Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) ...
    (microsoft.public.sqlserver.dts)
  • RE: Using Execute SQL Task to insert rows
    ... He set up a trigger on the ... "Foss" wrote: ... > Hi Frank, ... > Sorry, I'm very new to all this, when I said subquery I was referring to the ...
    (microsoft.public.sqlserver.dts)
  • Re: update 2 fields problem
    ... as the SQL Server optimizer will usually generate the ... This changes if the subquery has to be duplicated. ... order in which matches are found depends on the execution plan, ... still be affected by the UPDATE statement and the new values for Column1 ...
    (microsoft.public.sqlserver.programming)

Loading