SSIS Designer Freezing Up When Using The Debug Utility !
Jan 23, 2007
I am executing a single package that references 180 other packages , after executing the first 90-100 packages , SSIS designer completely freezes and then i have to kill the session using Task Manager . Is this a limitation of SSIS or is it a system constraint ?
If you have any suggestions or workarounds for de same plz do reply
I am experiencing an error where the ssis data flow task would freeze and stop data export from a oledb source to a text file. It doesn't generate any errors the ssis package would just hang. This only happens when I run it in 64 bit mode. When I change the mode to 32 bit the ssis never freezes and runs fine. Has anyone experience this? Is there a fix so I can run my jobs in 64 bit mode?
I have followed the instructions for SSIS Lesson 1 exactly but i get these 4 errors when I come to debug at the "Lookup Date Key" lookup transformation. Last step in the lesson.
1. [Lookup Date Key [66]] Error: Row yielded no match during lookup. 2. [Lookup Date Key [66]] Error: The "component "Lookup Date Key" (66)" failed because error code 0xC020901E occurred, and the error row disposition on "output "Lookup Output" (68)" specifies failure on error. An error occurred on the specified object of the specified component. 3. [DTS.Pipeline] Error: The ProcessInput method on component "Lookup Date Key" (66) failed with error code 0xC0209029. The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. 4. [DTS.Pipeline] Error: Thread "WorkThread0" has exited with error code 0xC0209029.
I have tried this on 2 hardware setups and recreated the package several times on both. The only thing i can think of is that the collations on both servers is SQL_Latin1_CP1_CI_AS and British English (I have huge legacy databases from SQL 7.0 and cannot get my tech support to change language settings of server to UK English). Is it possible that this is causing the lookup failure mentioned above (Q1)? How can I change the collation/language settings within the DTS so that the text file matches the AdventureWorksDW database settings if this is the issue (Q2)?
Are the error codes listed anywhere and if not can they be added BOL (Q3)? I have read other threads and they suggest 0xC0209029 means lookup failed due to differing lengths. Can dates have differing lengths (Q4)?
I just ran across an interesting problem, that makes no sense. I built an SSIS package that updates a column, using an transformation script. Testing in Debug mode everything runs perfectly, but when I have SQL sever agent run the package it insert null into the new column.
Any thoughts or suggestions would be greatly appreciated.
I developed my package in BI studio and tested runnning it through BI. Now when i have to deploy the package to main server it will be executed via batch job. This package requires an input file name too. Now when i am trying to run the package on my loacal box using following command on command prormpt i get error given below.
COMMAND USED BY ME: DTExec /FILE 'C:ProjectIntegrationServicesSFRIntegrationServicesinpkgSFRLocation.dtsx' /SET Package.Variables[InputParamFileName].Value;'C:DataDumpInputLOC00022'
ERROR MESSAGE: Microsoft (R) SQL Server Execute Package Utility Version 9.00.1399.06 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
Started: 1:29:54 PM Error: 2008-02-22 13:29:54.96 Code: 0xC0011007 Source: {9B1FAA88-A6FA-44CF-A2E2-DB3F737FDA65} Description: Unable to load the package as XML because of package does not ha ve a valid XML format. A specific XML parser error will be posted. End Error Error: 2008-02-22 13:29:54.96 Code: 0xC0011002 Source: {9B1FAA88-A6FA-44CF-A2E2-DB3F737FDA65} Description: Failed to open package file "'C:ProjectIntegrationServicesSFR IntegrationServicesinpkgSFRLocation.dtsx'" due to error 0x800700A1 "The speci fied path is invalid.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage o r the XML file was specified and has an incorrect format. End Error Could not load package "'C:ProjectIntegrationServicesSFRIntegrationServices inpkgSFRLocation.dtsx'" because of error 0xC0011002. Description: Failed to open package file "'C:ProjectIntegrationServicesSFRInt egrationServicesinpkgSFRLocation.dtsx'" due to error 0x800700A1 "The specifie d path is invalid.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of eit her providing an incorrect file name was specified when calling LoadPackage or t he XML file was specified and has an incorrect format. Source: {9B1FAA88-A6FA-44CF-A2E2-DB3F737FDA65} Started: 1:29:54 PM Finished: 1:29:54 PM Elapsed: 0.047 seconds
PLease let me know solution to creating batch job for executing this pkg with input param.
I developed my package in BI studio and tested runnning it through BI. Now when i have to deploy the package to main server it will be executed via batch job. This package requires an input file name too. Now when i am trying to run the package on my loacal box using following command on command prormpt i get error given below.
COMMAND USED BY ME: DTExec /FILE 'C:ProjectIntegrationServicesSFRIntegrationServicesinpkgSFRLocation.dtsx' /SET Package.Variables[InputParamFileName].Value;'C:DataDumpInputLOC00022'
ERROR MESSAGE: Microsoft (R) SQL Server Execute Package Utility Version 9.00.1399.06 for 32-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
Started: 1:29:54 PM Error: 2008-02-22 13:29:54.96 Code: 0xC0011007 Source: {9B1FAA88-A6FA-44CF-A2E2-DB3F737FDA65} Description: Unable to load the package as XML because of package does not ha ve a valid XML format. A specific XML parser error will be posted. End Error Error: 2008-02-22 13:29:54.96 Code: 0xC0011002 Source: {9B1FAA88-A6FA-44CF-A2E2-DB3F737FDA65} Description: Failed to open package file "'C:ProjectIntegrationServicesSFR IntegrationServicesinpkgSFRLocation.dtsx'" due to error 0x800700A1 "The speci fied path is invalid.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of either providing an incorrect file name was specified when calling LoadPackage o r the XML file was specified and has an incorrect format. End Error Could not load package "'C:ProjectIntegrationServicesSFRIntegrationServices inpkgSFRLocation.dtsx'" because of error 0xC0011002. Description: Failed to open package file "'C:ProjectIntegrationServicesSFRInt egrationServicesinpkgSFRLocation.dtsx'" due to error 0x800700A1 "The specifie d path is invalid.". This happens when loading a package and the file cannot be opened or loaded correctly into the XML document. This can be the result of eit her providing an incorrect file name was specified when calling LoadPackage or t he XML file was specified and has an incorrect format. Source: {9B1FAA88-A6FA-44CF-A2E2-DB3F737FDA65} Started: 1:29:54 PM Finished: 1:29:54 PM Elapsed: 0.047 seconds
PLease let me know solution to creating batch job for executing this pkg with input param.
When I create a deployment utility I... - set AllowConfigurationChanges to True. - set CreateDeploymentUtility to True - DeploymentOutputPath is set to binDeployment - I click 'Build' and it creates the binDeployment directory and writes all my DTSX files and my dtsConfig file But it doesn't create a manifest file. Why not? Thanks
I have sql server 2005 express and toolkits installed. However, I only see Report Server projects in my Visual Studio 2005 when I choose a Business Intelligence project.
Will someone please help me download the right file to start using SSIS designer?
I have a script which grabs data from a source server. The problem is I have over 50 source servers, so I have to make a script for each one.. EXACTLY the same code but different linked server address.
So I was wondering if i can put the server name into a variable so I only need to make one script. Is that possible?
When I drop a new component onto the design surface, it appears with dotted lines around it, as it is selected.
But, the F2 key (the hotkey for rename) does not work.
I have to click on some other component, and then back on the new component, and then the F2 key works.
I remember reporting this bug back in the beta cycle, but it is still present even in the release -- I actually think Ã?'m using the SP1 version of 2005, but see version info below to be sure:
Remote terminal services broke my copy buffer again, as is so often does, so pasting in the version info failed -- falling back to manual typing -- SSIS 9.00.2047.00.
After moving my deployment folder to the Target Server, I run the Installation Wizard. As I move next, I am missing the window which is supposed to allow me to set package config values as stated in MSDN:
"If the package includes configurations, you can edit updatable configurations by updating values in the Value list on the Configure Packages page."
Does anyone know why I am not seeing it? In my deployment bundle which I have moved over has currently 3 files:
1) SSIS Deployment Manifest
2) SSIS Package
3) SSIS Config File
Again, I double click on SSIS Deployment Manifest, and it starts fine. I go thru the steps for File System Deployment, and then it prompts for installation folder path. After that, it takes me directly to validation. Why is it not showing me the Configure Packages Page as described in the MSDN Documentation. Please advise. Thanks.
I have created a solution which contains only 2 packages say Package1.dtsx and Pakage2.dtsx. I want to create a deployment utility to deploy onto other developers machince. I changed the project properties "CreateDeploymentUtility" to TRUE. When I do the build it is not creating the files in "Deployment" folder. It is saying Rebuild All Failed but the error is not showing.
For more information the 2 packages have 4 indirect configurations from environment variables which are storing the actual config file path.
SSIS 2008 when I develop and debug in BIDS sometimes ignores debug break point.
The script component is in the main control flow and at some point the breakpoint did work.
If, for example, I create a new project and copy my script component there the debug breakpoint will work.So it's absolutely *random* when it works and when it does not.
Below is my BIDS detail:
Microsoft Visual Studio 2008 Version 9.0.30729.4462 QFE Microsoft .NET Framework Version 3.5 SP1 Installed Edition: IDE Standard Enterprise Library v5 Configuration Editor  4.0
When I installed SP1 on my SQL Server 2005, the performance of the package designer dropped enormously. I have to wait like 30 seconds after I drag-and-drop a datasource from the toolbox to the design area. Also it takes a very long time to run the very simple package. Not to mention opening some complicated package that was done before applying SP1. The package scheduled in SQL Agent went from 3-4min to 5-6min.
Can anyone address this issue? Maybe there's something I did wrong?
While installing SP1 I ecountered strange behaviour (some messages about file locking, rebooting and stuff), but in the end it said that it was successful
When running a package in VS you can see something like this in the output window:
SSIS package "logging.dtsx" starting. Information: 0x40043006 at Data Flow Task, DTS.Pipeline: Prepare for Execute phase is beginning. Information: 0x40043007 at Data Flow Task, DTS.Pipeline: Pre-Execute phase is beginning. Information: 0x402090DC at Data Flow Task, Flat File Source [1]: The processing of file "C: est ssis loggingad_data1.txt" has started. Information: 0x4004300C at Data Flow Task, DTS.Pipeline: Execute phase is beginning. Warning: 0x8020200F at Data Flow Task, Flat File Source [1]: There is a partial row at the end of the file. Information: 0x402090DE at Data Flow Task, Flat File Source [1]: The total number of data rows processed for file "C: est ssis loggingad_data1.txt" is 477. Information: 0x402090DF at Data Flow Task, OLE DB Destination [1011]: The final commit for the data insertion has started. Information: 0x402090E0 at Data Flow Task, OLE DB Destination [1011]: The final commit for the data insertion has ended. Information: 0x40043008 at Data Flow Task, DTS.Pipeline: Post Execute phase is beginning. Information: 0x402090DD at Data Flow Task, Flat File Source [1]: The processing of file "C: est ssis loggingad_data1.txt" has ended. Information: 0x40043009 at Data Flow Task, DTS.Pipeline: Cleanup phase is beginning. Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "DataReaderDest" (87)" wrote 0 rows. Information: 0x4004300B at Data Flow Task, DTS.Pipeline: "component "OLE DB Destination" (1011)" wrote 1 rows. SSIS package "logging.dtsx" finished: Success.
This is exactly when I need when a package is running but I want to be able to see it without using Visual Studio. I would do it in Reporting Services but I need to find out to get the information. The SSIS logging feature in a package does not provide that kind of info.
Our Visual Studio installation suddenly starting producing the error below upon trying to open any .dtsx package; although by "suddenly" I'm sure it was due to some Windows update or other program install, update, or uninstall. I've spent two days uninstalling, reinstalling, and repairing everything that is seemingly related to VS, but no luck. I've searched the forums and could not find this specific error mentioned, although I have tried some of the suggestions to fix possibly related 'class not registered' errors, but again no luck.
=================================== There was an error displaying the layout. (Microsoft Visual Studio) ------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%u00ae+Visual+Studio%u00ae+2005&ProdVer=8.0.50727.762&EvtSrc=Microsoft.DataTransformationServices.Design.SR&EvtID=DDSErrorDeserializeDiagram&LinkId=20476 =================================== Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) (msddsp) ------------------------------ Program Location: at MSDDS.IDdsDiagram.CreateShape(String ProgID, Boolean Visible, Int32 X, Int32 Y) at Microsoft.DataWarehouse.Controls.Interop.AxMSDDS.CreateShape(String progID, Boolean visible, Int32 x, Int32 y) at Microsoft.DataWarehouse.Design.ComponentDiagram.OnCreateShape(Object logicalObject, Int32 x, Int32 y, Boolean visible) at Microsoft.DataTransformationServices.Design.DtsComponentDiagram.OnCreateShape(Object component, Int32 x, Int32 y, Boolean visible) at Microsoft.DataWarehouse.Design.ComponentDiagram.CreateShape(Object logicalObject, Int32 x, Int32 y) at Microsoft.DataTransformationServices.Design.DtrControlFlowDiagram.CreateExecutableShape(DtsContainer dtsContainer, Int32 x, Int32 y, Int32 width, Int32 height) at Microsoft.DataTransformationServices.Design.DtrControlFlowDiagram.RefreshSequenceExecutables(IDTSSequence sequence) at Microsoft.DataTransformationServices.Design.DtrControlFlowDiagram.AfterDeserialize()
If you try to "enable memory restriction" from the Lookup component GUI you need to input both 32 and 64 bit size of maximum memory. However when clicking "OK" on the editor you get a message like :
TITLE: Microsoft Visual Studio ------------------------------
Error at Update Execution Logs [Lookup folder path 1 [4429]]: Failed to set property "MaxMemoryUsage64" on "component "Lookup folder path 1" (4429)".
This would actually be funny if I weren't under serious time constraints right now. I have an SSIS project with several script tasks in the control flow. I put breakpoints in one of them to allow me to step through and see whats going on. However, when I start the project, the IDE brings up the script editor for a different script task. The breakpoints in this task are actually on the same line numbers as the task I need to debug but the code is all wrong. I checked the task for which the code is being displayed and there are no breakpoints there.
I have stumbled on a problem with running a large number of SSIS packages in parallel, using the €œdtexec€? command from inside an SQL Server job.
I€™ve described the environment, the goal and the problem below. Sorry if it€™s a bit too long, but I tried to be as clear as possible.
The environment: Windows Server 2003 Enterprise x64 Edition, SQL Server 2005 32bit Enterprise Edition SP2.
The goal: We have a large number of text files that we€™re loading into a staging area of a data warehouse (based on SQL Server 2k5, as said above).
We have one €œmain€? SSIS package that takes a list of files to load from an XML file, loops through that list and for each file in the list starts an SSIS package by using €œdtexec€? command. The command is started asynchronously by using system.diagnostics.process.start() method. This means that a large number of SSIS packages are started in parallel. These packages perform the actual loading (with BULK insert).
I have successfully run the loading process from the command prompt (using the dtexec command to start the main package) a number of times.
In order to move the loading to a production environment and schedule it, we have set up an SQL Server Agent job. We€™ve created a proxy user with the necessary rights (the same user that runs the job from command prompt), created an the SQL Agent job (there is one step of type €œcmdexec€? that runs the €œmain€? SSIS package with the €œdtexec€? command).
If the input XML file for the main package contains a small number of files (for example 10), the SQL Server Agent job works fine €“ the SSIS packages are started in parallel and they finish work successfully.
The problem: When the number of the concurrently started SSIS packages gets too big, the packages start to fail. When a large number of SSIS package executions are already taking place, the new dtexec commands fail after 0 seconds of work with an empty error message.
Please bear in mind that the same loading still works perfectly from command prompt on the same server with the same user. It only fails when run from the SQL Agent Job.
I€™ve tried to understand the limit, when do the packages start to fail, and I believe that the threshold is 80 parallel executions (I understand that it might not be desirable to start so many SSIS packages at once, but I€™d like to do it despite this).
Additional information:
The dtexec utility provides an error message where the package variables are shown and the fact that the package ran 0 seconds, but the €œMessage€? is empty (€œMessage: €œ). Turning the logging on in all the packages does not provide an error message either, just a lot of run-time information. The try-catch block around the process.start() script in the main package€™s script task also does not reveal any errors. I€™ve increased the €œmax worker threads€? number for the cmdexec subsystem in the msdb.dbo.syssubsystems table to a safely high number and restarted the SQL Server, but this had no effect either.
The request:
Can anyone give ideas what could be the cause of the problem? If you have any ideas about how to further debug the problem, they are also very welcome. Thanks in advance!
I have a full database backup job that runs every night at 10:00 pm. Normally, this job takes about 20 minutes to complete. Recently, this backup job has been "freezing" up, or hanging, and then I manually have to go in, cancel the job, start the job again, and hope it completes.
Some info about the database: only a MB or two is added to it each day. There are no other backups, loads, dumps,or any other processes running when this backup occurs. There are other databases on this server, but again, they do not load, dump, or have any other processes running at the time of this backup. All of the other scheduled backups for the other databases work fine.
Any ideas on what could be happening and why this particular job is hanging?
My 2000 sp3 sql analyzer keeps freezing when closing a window. This is not during a query, and I may not have even edited anything. The entire app will freeze, and after hitting the close button several times, it will get around to an "End Task" popup, and finally close. Doesn't happen every time, doesn't happen with the same number of windows open or the same query open. I have unloaded, reloaded, etc...Still occurs. :confused: Any ideas? TIA.
I have the following table with about 4 million rows: CREATE TABLE [newauth] ( [authnumber] [int] NULL , [batchnumber] [int] NULL , [accountnumber] [varchar] (20) NULL, [authcode] [varchar] (10) NULL , [authused] [char] (1) NULL , [loaddate] [int] NULL , [trandate] [int] NULL , [trantime] [int] NULL , [cardtype] [char] (1) NULL , [mcc] [char] (4) NULL , [amount] [int] NULL , [transactionnumber] [int] NULL ) ON [PRIMARY] GO
There is an index on the authnumber field. I am calling the following stored procedure to update the transactionnumber.
CREATE PROCEDURE UpdateAuthWithTrans(@lAuth int, @lTrans int) AS UPDATE NewAuth SET TransactionNumber = @lTrans WHERE AuthNumber = @lAuth GO
I need to update about 1 million rows. Approx 50000 calls to this SP work OK. Then the DB freezes. Enterprise mgr shows the following (screen shot attached)
I cant figure out why this is freezing. I have tried update statistics newauth, dbcc checktable, rebuilding the index, rebooting the server.
Any ideas would be appreciated, thanks in advance for any help.
Is it possible to freeze columns in a table elements. Lots of times we are being forced to use matrix to freeze columns - when in fact we should actually be using a table element.
Any idea if this is going to be part of MSRS in the future or should we just use matrixes..
I am completely new to this forum, so forgive me if I am in the wrong place.
I have been running this application for about 3 years with no problems, but over the past couple of weeks I have been having major issues!
Background: I am running an Access 2003 frontend with SQL Server 2000 backend. The SQL Server resides on the server, and each user has a local copy of the Access 2003 application.
Issues: Over the past couple of weeks users have been recieving errors that lock everyone's application up, and the server has to be rebooted. Some of the errors recieved: [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite (send()). (#10054)
[Microsoft][ODBC SQL Server Driver][DBNETLIB]General network error. Check your network documentation. (#11)
Microsoft][ODBC SQL Server Driver][DBNETLIB]Timeout Expired (#0)
So after these errors occur, they have to reboot the server. It has happened to different users, never the same user, but once and error occurs, it locks up every user. I have searched the internet high and low for troubleshooting, but have not found anything to fix these issues. I am not really knowledgable with SQL server. I created the database in Access and then used the upsize wizard to get it into SQL.
Oh, and I have also checked the error logs and found nothing that stands out as an error problem.
I'm experiencing quite an interesting issue with our database. We're currently running SQL Server 2005 Standard (x64) (v9.00.3054.00) and I have a block of code that just insists on not working within a UDF. Everything I've read seems to point that I'm doing this corerctly but apparently I'm missing something.
Executing the query below:
DECLARE @sp DATETIME DECLARE @ep DATETIME DECLARE @trackType INT
SET @sp = '4/21/2008' SET @ep = '4/28/2008' SET @trackType = 1
SELECT c.unqempid, isnull(count(c.contactid),0) AS contacts, isnull(bookings.count,0) AS bookings, isnull(showed.count,0) AS showed, isnull(ow.totalPurchased,0) AS purchases, isnull(ow.totalSold,0) AS volume FROM contacts c WITH (NOLOCK) LEFT JOIN ( SELECT b.unqempid, ISNULL(count(bookingid),0) AS count FROM bookings b WITH (NOLOCK) INNER JOIN contacts c WITH (NOLOCK) ON c.contactid = b.relcontactid WHERE c.contactdt BETWEEN @sp AND @ep GROUP BY b.unqempid ) AS bookings ON bookings.unqempid = c.unqempid LEFT JOIN ( SELECT b.unqempid, ISNULL(count(bookingid),0) AS count FROM bookings b WITH (NOLOCK) INNER JOIN contacts c WITH (NOLOCK) ON c.contactid = b.relcontactid WHERE c.contactdt BETWEEN @sp AND @ep AND didshow > 0 GROUP BY b.unqempid ) AS showed ON showed.unqempid = c.unqempid LEFT JOIN ( SELECT c.unqempid, count(leadid) TotalPurchased, sum(saleprice) AS TotalSold FROM ordermgmt.dbo.orders o WITH (NOLOCK) INNER JOIN ordermgmt.dbo.appointments a WITH (NOLOCK) ON a.weborderid = o.orderid INNER JOIN contacts c WITH (NOLOCK) ON c.personid = a.leadid INNER JOIN bookings b WITH (NOLOCK) on b.relcontactid = c.contactid WHERE c.contactdt BETWEEN @sp AND @ep GROUP BY c.unqempid ) as ow ON ow.unqempid = c.unqempid WHERE c.contactdt BETWEEN @sp AND @ep GROUP BY c.unqempid, bookings.count, showed.count, ow.totalPurchased, ow.totalSold
Yields no issues however if I put this into a UDF, it runs and never finishes executing. I'm not quite sure what my issue was so I'm hoping someone could point out where my goof is.
Here is the function:
CREATE FUNCTION [dbo].[fnEmployeeSchedulingResults] ( @sp DATETIME, @ep DATETIME ) RETURNS TABLE AS RETURN (
SELECT c.unqempid, isnull(count(c.contactid),0) AS contacts, isnull(bookings.count,0) AS bookings, isnull(showed.count,0) AS showed, isnull(ow.totalPurchased,0) AS purchases, isnull(ow.totalSold,0) AS volume FROM contacts c WITH (NOLOCK) LEFT JOIN ( SELECT b.unqempid, ISNULL(count(bookingid),0) AS count FROM bookings b WITH (NOLOCK) INNER JOIN contacts c WITH (NOLOCK) ON c.contactid = b.relcontactid WHERE c.contactdt BETWEEN @sp AND @ep GROUP BY b.unqempid ) AS bookings ON bookings.unqempid = c.unqempid LEFT JOIN ( SELECT b.unqempid, ISNULL(count(bookingid),0) AS count FROM bookings b WITH (NOLOCK) INNER JOIN contacts c WITH (NOLOCK) ON c.contactid = b.relcontactid WHERE c.contactdt BETWEEN @sp AND @ep AND didshow > 0 GROUP BY b.unqempid ) AS showed ON showed.unqempid = c.unqempid LEFT JOIN ( SELECT c.unqempid, count(leadid) TotalPurchased, sum(saleprice) AS TotalSold FROM ordermgmt.dbo.orders o WITH (NOLOCK) INNER JOIN ordermgmt.dbo.appointments a WITH (NOLOCK) ON a.weborderid = o.orderid INNER JOIN contacts c WITH (NOLOCK) ON c.personid = a.leadid INNER JOIN bookings b WITH (NOLOCK) on b.relcontactid = c.contactid WHERE c.contactdt BETWEEN @sp AND @ep GROUP BY c.unqempid ) as ow ON ow.unqempid = c.unqempid WHERE c.contactdt BETWEEN @sp AND @ep GROUP BY c.unqempid, bookings.count, showed.count, ow.totalPurchased, ow.totalSold )