Re: Using 'Execute SQL Task' to insert rows
- From: "Foss" <Foss@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 1 Jul 2005 00:57:02 -0700
Hi there Allan,
Yes, I see what you mean.
However, I can't see where I've used anything like an = in my example.
I still can't see why this error message is relevant to my SQL.
Am I going the right way about trying to copy a number of rows from one
table to another?
Cheers,
Pete
--
Cheers,
Foss
"Allan Mitchell" wrote:
> 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
>
>
>
.
- Follow-Ups:
- Re: Using 'Execute SQL Task' to insert rows
- From: Foss
- Re: Using 'Execute SQL Task' to insert rows
- Prev by Date: RE: Using 'Execute SQL Task' to insert rows
- Next by Date: Re: File Unzip using DTS
- Previous by thread: RE: Using 'Execute SQL Task' to insert rows
- Next by thread: Re: Using 'Execute SQL Task' to insert rows
- Index(es):
Relevant Pages
|