dbTalk Databases Forums  

Query Problem using count and ?

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


Discuss Query Problem using count and ? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Stan Sainte-Rose
 
Posts: n/a

Default Query Problem using count and ? - 01-21-2004 , 04:42 AM






Hi,
I have a problem with a Query in my Package.
It works fine with a stored procedure but it quits SQL Enterprise when I use
it into a DataPumpTask.
It seems it's the Count function.
It bugs when I use the ? as parameter with memory read error, but if I set a
fixed value, it works.

Thanks for your help

Stan


SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
NB=(SELECT COUNT(*) FROM A_LOGCLIENTS INNER JOIN A_CLIENTS
ON A_CLIENTS.IDCLIENT=A_LOGCLIENTS.IDCLIENT
WHERE A_LOGCLIENTS.idclient = TT.idclient)
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?






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

Default Re: Query Problem using count and ? - 01-21-2004 , 04:54 AM






The design time interface is a little fragile.

I would use a query with the same metadata to build my datapump so

SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
'NB' as NB
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?

You can then do you parameter mapping and transformation mapping.

Now go to Disconnected Edit and replace the SourceSQLStatement property of
the DataPump task with the correct one.




--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote

Quote:
Hi,
I have a problem with a Query in my Package.
It works fine with a stored procedure but it quits SQL Enterprise when I
use
it into a DataPumpTask.
It seems it's the Count function.
It bugs when I use the ? as parameter with memory read error, but if I set
a
fixed value, it works.

Thanks for your help

Stan


SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
NB=(SELECT COUNT(*) FROM A_LOGCLIENTS INNER JOIN A_CLIENTS
ON A_CLIENTS.IDCLIENT=A_LOGCLIENTS.IDCLIENT
WHERE A_LOGCLIENTS.idclient = TT.idclient)
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?








Reply With Quote
  #3  
Old   
Stan Sainte-Rose
 
Posts: n/a

Default Re: Query Problem using count and ? - 01-21-2004 , 05:36 AM



Thanks Allan
But when I do it I get an Exception Access Violation when I run the package.
Stan



"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> a écrit dans le message de
news:ehjFrzA4DHA.2132 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Quote:
The design time interface is a little fragile.

I would use a query with the same metadata to build my datapump so

SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
'NB' as NB
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?

You can then do you parameter mapping and transformation mapping.

Now go to Disconnected Edit and replace the SourceSQLStatement property of
the DataPump task with the correct one.




--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote in message
news:e4ca0sA4DHA.1592 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Hi,
I have a problem with a Query in my Package.
It works fine with a stored procedure but it quits SQL Enterprise when I
use
it into a DataPumpTask.
It seems it's the Count function.
It bugs when I use the ? as parameter with memory read error, but if I
set
a
fixed value, it works.

Thanks for your help

Stan


SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
NB=(SELECT COUNT(*) FROM A_LOGCLIENTS INNER JOIN A_CLIENTS
ON A_CLIENTS.IDCLIENT=A_LOGCLIENTS.IDCLIENT
WHERE A_LOGCLIENTS.idclient = TT.idclient)
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?










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

Default Re: Query Problem using count and ? - 01-21-2004 , 05:40 AM



What SP level are you at (select @@version)

--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote

Quote:
Thanks Allan
But when I do it I get an Exception Access Violation when I run the
package.
Stan



"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> a écrit dans le message de
news:ehjFrzA4DHA.2132 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
The design time interface is a little fragile.

I would use a query with the same metadata to build my datapump so

SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
'NB' as NB
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?

You can then do you parameter mapping and transformation mapping.

Now go to Disconnected Edit and replace the SourceSQLStatement property
of
the DataPump task with the correct one.




--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote in message
news:e4ca0sA4DHA.1592 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Hi,
I have a problem with a Query in my Package.
It works fine with a stored procedure but it quits SQL Enterprise when
I
use
it into a DataPumpTask.
It seems it's the Count function.
It bugs when I use the ? as parameter with memory read error, but if I
set
a
fixed value, it works.

Thanks for your help

Stan


SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
NB=(SELECT COUNT(*) FROM A_LOGCLIENTS INNER JOIN A_CLIENTS
ON A_CLIENTS.IDCLIENT=A_LOGCLIENTS.IDCLIENT
WHERE A_LOGCLIENTS.idclient = TT.idclient)
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?












Reply With Quote
  #5  
Old   
Stan Sainte-Rose
 
Posts: n/a

Default Re: Query Problem using count and ? - 01-21-2004 , 05:55 AM



8.00.760 (Intel X86) 12/17/2002

Stan
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> a écrit dans le message de
news:OyDPnNB4DHA.2348 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Quote:
What SP level are you at (select @@version)

--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote in message
news:eoESlKB4DHA.488 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Thanks Allan
But when I do it I get an Exception Access Violation when I run the
package.
Stan



"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> a écrit dans le message de
news:ehjFrzA4DHA.2132 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
The design time interface is a little fragile.

I would use a query with the same metadata to build my datapump so

SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
'NB' as NB
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?

You can then do you parameter mapping and transformation mapping.

Now go to Disconnected Edit and replace the SourceSQLStatement
property
of
the DataPump task with the correct one.




--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote in message
news:e4ca0sA4DHA.1592 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Hi,
I have a problem with a Query in my Package.
It works fine with a stored procedure but it quits SQL Enterprise
when
I
use
it into a DataPumpTask.
It seems it's the Count function.
It bugs when I use the ? as parameter with memory read error, but if
I
set
a
fixed value, it works.

Thanks for your help

Stan


SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
NB=(SELECT COUNT(*) FROM A_LOGCLIENTS INNER JOIN A_CLIENTS
ON A_CLIENTS.IDCLIENT=A_LOGCLIENTS.IDCLIENT
WHERE A_LOGCLIENTS.idclient = TT.idclient)
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?














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

Default Re: Query Problem using count and ? - 01-21-2004 , 06:13 AM



There are some hotfixes out on the MS site to take you to


Microsoft SQL Server 2000 - 8.00.818 (Intel X86)
May 31 2003 16:08:15
Copyright (c) 1988-2003 Microsoft Corporation
Developer Edition on Windows NT 5.0 (Build 2195: Service Pack 4)


That shouldn't make this difference here.

So even after entering the SourceSQLStatement how I said it does this?
This is at runtime right or design time?




--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote

Quote:
8.00.760 (Intel X86) 12/17/2002

Stan
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> a écrit dans le message de
news:OyDPnNB4DHA.2348 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
What SP level are you at (select @@version)

--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote in message
news:eoESlKB4DHA.488 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Thanks Allan
But when I do it I get an Exception Access Violation when I run the
package.
Stan



"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> a écrit dans le message de
news:ehjFrzA4DHA.2132 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
The design time interface is a little fragile.

I would use a query with the same metadata to build my datapump so

SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
'NB' as NB
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT = TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?

You can then do you parameter mapping and transformation mapping.

Now go to Disconnected Edit and replace the SourceSQLStatement
property
of
the DataPump task with the correct one.




--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote in message
news:e4ca0sA4DHA.1592 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Hi,
I have a problem with a Query in my Package.
It works fine with a stored procedure but it quits SQL Enterprise
when
I
use
it into a DataPumpTask.
It seems it's the Count function.
It bugs when I use the ? as parameter with memory read error, but
if
I
set
a
fixed value, it works.

Thanks for your help

Stan


SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
NB=(SELECT COUNT(*) FROM A_LOGCLIENTS INNER JOIN A_CLIENTS
ON A_CLIENTS.IDCLIENT=A_LOGCLIENTS.IDCLIENT
WHERE A_LOGCLIENTS.idclient = TT.idclient)
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT =
TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?
















Reply With Quote
  #7  
Old   
Stan Sainte-Rose
 
Posts: n/a

Default Re: Query Problem using count and ? - 01-21-2004 , 06:22 AM



At the runtime.
Stan


"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> a écrit dans le message de
news:u0SAvfB4DHA.632 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Quote:
There are some hotfixes out on the MS site to take you to


Microsoft SQL Server 2000 - 8.00.818 (Intel X86)
May 31 2003 16:08:15
Copyright (c) 1988-2003 Microsoft Corporation
Developer Edition on Windows NT 5.0 (Build 2195: Service Pack 4)


That shouldn't make this difference here.

So even after entering the SourceSQLStatement how I said it does this?
This is at runtime right or design time?




--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote in message
news:OLWzUVB4DHA.1592 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
8.00.760 (Intel X86) 12/17/2002

Stan
"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> a écrit dans le message de
news:OyDPnNB4DHA.2348 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
What SP level are you at (select @@version)

--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote in message
news:eoESlKB4DHA.488 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Thanks Allan
But when I do it I get an Exception Access Violation when I run the
package.
Stan



"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> a écrit dans le message
de
news:ehjFrzA4DHA.2132 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
The design time interface is a little fragile.

I would use a query with the same metadata to build my datapump so

SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
'NB' as NB
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT =
TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?

You can then do you parameter mapping and transformation mapping.

Now go to Disconnected Edit and replace the SourceSQLStatement
property
of
the DataPump task with the correct one.




--

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

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Stan Sainte-Rose" <stan (AT) cyber972 (DOT) com> wrote in message
news:e4ca0sA4DHA.1592 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
Hi,
I have a problem with a Query in my Package.
It works fine with a stored procedure but it quits SQL
Enterprise
when
I
use
it into a DataPumpTask.
It seems it's the Count function.
It bugs when I use the ? as parameter with memory read error,
but
if
I
set
a
fixed value, it works.

Thanks for your help

Stan


SELECT DISTINCT
A_CLIENTS.idclient,
CAST(A_CLIENTS.CLICODE AS VARCHAR) AS CLICODE,
ISNULL(A_CLIENTS.CLIEMAIL, '') AS CLIEMAIL,
A_CLIENTS.CLIMDP,
TT.LOGDATE,
NB=(SELECT COUNT(*) FROM A_LOGCLIENTS INNER JOIN A_CLIENTS
ON A_CLIENTS.IDCLIENT=A_LOGCLIENTS.IDCLIENT
WHERE A_LOGCLIENTS.idclient = TT.idclient)
FROM A_CLIENTS
LEFT OUTER JOIN A_LOGCLIENTS TT ON A_CLIENTS.IDCLIENT =
TT.IDCLIENT
WHERE A_CLIENTS.IDSOCIETE = ?


















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.