Re: Using 'Execute SQL Task' to insert rows
- From: "Allan Mitchell" <allan@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 20:51:18 +0100
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
something similar to
select * from dbo.MyTableWHERE Col1 = (select 1 union select 2)
This is bad because you cannot have a value on the left == two values on the
right. If I change this to
select * from dbo.MyTableWHERE Col1 IN (select 1 union select 2)
Then we are back up and working.
Does this help you pinpoint the error?
--
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know
"Foss" <Foss@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:71B04E5C-7511-4F85-B156-26A462CD783F@xxxxxxxxxxxxxxxx
> 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
.
- References:
- Using 'Execute SQL Task' to insert rows
- From: Foss
- Using 'Execute SQL Task' to insert rows
- Prev by Date: RE: Job Says Successful but Fails to Execute Package
- Next by Date: Re: Changing the DataSource in a loop
- Previous by thread: RE: Using 'Execute SQL Task' to insert rows
- Next by thread: How function a DTS handeld in Visual Basic
- Index(es):
Relevant Pages
|