Monday, April 15, 2013

[SQL Server] Export data to flat file based on field once.

[SQL Server] Export data to flat file based on field once.


Export data to flat file based on field once.

Posted: 15 Apr 2013 11:26 AM PDT

Hi all,I have a table that is selecting all the fields from the table and exporting to flat file in SSIS. One of the field in the table "Sent" is set to "0" by default. So when the SSIS package runs the query will set the field "Sent to "1" before moving the data to flat file. My question is how should I enforce the SSIS process to not send the data again after the field is set to 1. The process should only move the data to flat file once based on the "Sent" field. If the SSIS process runs again it should either fail or run with no data move to file.Please reply if anyone know regarding this.Thanks.

Date Intervals like YTD

Posted: 15 Apr 2013 04:28 AM PDT

My requirement is,we have a drop down in our application with YTD,QTD,MTDYTD--Year To Till Date.QTD--Quarterly To Till Date.MTD--Monthly To Till Date.Please suggest me a query for retrieving values for the selected item from dropdown.

Find client accounts missing a specific service

Posted: 15 Apr 2013 12:51 AM PDT

I am looking for the right way to determine a missing service from all similar client accounts. We have six different regions with multiple clients. Only One region has this specific service for all of its regional clients. This service is mandatory, so all client accounts must have/show this service. Each client account has a "Portfolio" containing all the offered services.What I want to do is to run a query to find all portfolios for Region 1 where this specific service is missing for this one region. Since all Portfolios across the six regions are set up the same way a simple WHERE NOT EXIST statement will return thousands of records that are irrelevant since they don't contain this service already.The Code I am trying to use is as follows:SELECT dbo.ACCOUNT.PORTFOLIOFROM dbo.ACCOUNT INNER JOIN dbo.SERVICE_JOIN ON dbo.ACCOUNT.PORT_ROW_ID = dbo.SERVICE_JOIN.PORTFOLIO_ID INNER JOIN dbo.SERVICES ON dbo.SERVICE_JOIN.SERVICE_ID = dbo.SERVICES.ROW_ID INNER JOIN dbo.CONTACT_JOIN ON dbo.SERVICE_JOIN.SERVICE_ID = dbo.CONTACT_JOIN.SERVICE_ID INNER JOIN dbo.CONTACTS ON dbo.CONTACT_JOIN.CONTACT_ID = dbo.CONTACTS.ROW_ID FULL OUTER JOIN dbo.NOTES ON dbo.SERVICES.SERVICE_TYPE = dbo.NOTES.SERVICE_TYPE AND dbo.ACCOUNT.ACC_ROW_ID = dbo.NOTES.ACCOUNT_IDWHERE EXISTS (SELECT dbo.ACCOUNT.PORTFOLIO FROM dbo.ACCOUNT WHERE dbo.CLIENT.REGION = 'R1') WHERE NOT EXISTS (SELECT dbo.ACCOUNT.PORTFOLIO FROM dbo.ACCOUNT WHERE dbo.DM_SERVICES.SERVICE = 'MISSING_SERVICE')My reasoning is that I am trying to find the portfolios where the service is missing and trying to restrict the search to the one region so we may add them back in. I have included the full code containing the joins for multiple tables where the combined informaton for the accounts are which is correct. My issue seems to begin after the where clause.My error message is this:"Msg 156, Level 15, State 1, Line 13Incorrect syntax near the keyword 'WHERE'."Line 13 ia actually the WHERE NOT EXIST statement.Any tips and suggestions would be greatly appreciated.James

SQL SSRS 2008

Posted: 17 Nov 2008 05:01 AM PST

Where are the Report Properties for setting the default Start and End Date and Calendar in the ReportThank You from NewBies

No comments:

Post a Comment

Search This Blog