Quantcast
Channel: SQL Server Integration Services forum
Viewing all 24688 articles
Browse latest View live

Compare 2 string columns YYYY-Weekno in ssis

$
0
0

Hi all,

I have a 2 string columns in Table contains YYYY-Weekno . I want to compere these 2 columns. How is possible.?

I have to pass values in Conditional split transformation Date1 > date2 then update below tasks like way..

Example :     Date1                     Date2 

                   2018-35                 2017-44

                  2019-45                 2019-11

I want to compare these 2 column in ssis expressions which is latest … or is there any possible to convert it in to date in throw expression and compare ?  

Thanks,

Sriraj


'Microsoft.ACE.OLEDB.12.0' provider not working in 64 bit Windows 10 and office 2016

$
0
0

How to fix the error "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine." on Windows 10 64 bit PC, 64 bit Office 2016.
I am receiving this error when I try to import .xlsx thru "SQL Server Import and Export Wizard" and also thru SSIS.
I've installed 64 bit ACE Provider and still getting the same error.

Any help is highly appreciated.

Thanks



Do you want to be acknowledged as SQL Server Integration Services Guru? Submit your work to November 2019 competition!

$
0
0

What is TechNet Guru Competition?

Each month the TechNet Wiki council organizes a contest of the best articles posted that month. This is your chance to be announced as MICROSOFT TECHNOLOGY GURU OF THE MONTH!

One winner in each category will be selected each month for glory and adoration by the MSDN/TechNet Ninjas and community as a whole. Winners will be announced in dedicated blog post that will be published in Microsoft Wiki Ninjas blog, a tweet from the Wiki Ninjas Twitter account, links will be published at Microsoft TNWiki group on Facebook, and other acknowledgement from the community will follow.

Some of our biggest community voices and many MVPs have passed through these halls on their way to fame and fortune.

If you have already made a contribution in the forums or gallery or you published a nice blog, then you can simply convert it into a shared wiki article, reference the original post, and register the article for the TechNet Guru Competition. The articles must be written in November 2019 and must be in English. However, the original blog or forum content can be from beforeNovember 2019.

Come and see who is making waves in all your favorite technologies. Maybe it will be you!


Who can join the Competition?

Anyone who has basic knowledge and the desire to share the knowledge is welcome. Articles can appeal to beginners or discusse advanced topics. All you have to do is to add your article to TechNet Wiki from your own specialty category.


How can you win?

  1. Please copy/Write over your Microsoft technical solutions and revelations to TechNetWiki.
  2. Add a link to your new article on THIS WIKI COMPETITION PAGE (so we know you've contributed)
  3. (Optional but recommended) Add a link to your article at the TechNetWiki group on Facebook. The group is very active and people love to help, you can get feedback and even direct improvements in the article before the contest starts.

Do you have any question or want more information?

Feel free to ask any questions below, or Join us at the official MicrosoftTechNet Wiki groups on facebook. Read More about TechNet Guru Awards.

If you win, people will sing your praises online and your name will be raised as Guru of the Month.


PS: Above top banner came from Kamlesh Kumar.





JAYENDRAN ARUMUGAM

Load entire JSON file content into a SQL table data truncation occurs.

$
0
0

Hi All

I'm trying to load the entire content of JSONfiles from a folder into a SQL table (SQL 2017). Most of the files gets loaded with their entire content but some files don't. Destination Table column is NVARCHAR(MAX) to store the JSON content.

Using DataFlow Task --> Flatfile to OLEDB Destination , 

I tried using both DT_NTEXT / DT_TEXT to load the content.  

I'm not sure about the settings on the SSIS Flat File Souce connection string settings , i.e Rows/Columns Delimiters. Can someone advise on what best settings to use to read the entire content into the table cell using SSIS. 

Is it the right way to read JSON content ? else use Script task to read the file content ? 
Many thanks in advance. 



How to add drop downs to excel exports

$
0
0

I am creating dynamic excel files with each file consisting of 2 worksheets in it. In both the worksheets I am looking to create a drop down with few values for few of my columns. 

I am not getting it to be done using ssis excel destination.

Thanks

Cannot run SSIS package with DTEXEC from cmd

$
0
0

Happy Friday,

Could you please advice

I am running in cmd: dtexec /F <filename>

Im facing an error:

   Code: 0xC000F427
   Source: Data Flow Task SSIS.Pipeline
   Description: To run a SSIS package outside of SQL Server Data Tools you must install Standard Edition (64-bit) of Integration Services or higher.


I searched this topic and I am aware about versions

I reinstalled my VS 19 and SSIS today, MSSQL was installed 2 days ago as well

versions:

VS : 16.3.7

MSSQL: 15.0.18183

Windows: Windows 10, 10.0.16299

SSIS: 

DTS:LastModifiedProductVersion="15.0.1301.433"
DTS:Name="PackageFormatVersion">8</DTS:Property>

dtexec is:

Version 14.0.1000.169 for 64-bit

I tried to run explicitly with 

C:\Program Files\Microsoft SQL Server\140\DTS\Binn\dtexec.exe

In VS in project settings: SQL Server 2017

I ve localized the problem - it appears when I add 'derived column' component in 'data flow task' in ssis package

so without it - it works via cmd with dtexec

And it works from VS with all the components (including derived column)

Thanks in advance




how can i get rid of xml remnants left over from original pkg

$
0
0

Hi we run 2017 std. I used an existing pkg to author a new pkg with similar architecture but different tables. Its pretty clear to me that a remnant "select" in what ssis calls a sqlcommand property (sql command to be executed) belonging to a dft has come over and never left.  It references the table that was replaced.

This in spite of the fact that the command for that dft is from a variable whose sqlcommandvariable property I see right in the xml beneath this sqlcommand property. 

Is there a way to get rid of unused remnants like this?  The reason I ask is that if someone is looking in the code to make sure they have "gotten" every reference to the old table removed, they cant.  I opened the dft, changed to sql command, saw nothing , changed back to the var, closed, saved, reopened the code and the reference is still there.   

How to add WHERE clause in expression builder

$
0
0

Hi All

I have a package in which the source is a (SQL Command from variable).

The expression and the evaluated values are like below

"select " +  @[User::SourceColumns] + " from " +  @[User::SourceTable] + ";"

Select empid,empdate

from dbo.ecoemp

Now i want to limit the data for the past 180 days

How can i add the (where datediff(dd,empdate,getdate())<=180

in the expression.

Thanks


Access Dynamics CRM via SSIS OData: estimatedclosedate null

$
0
0

Hi all,

I'm developing a SSIS solution to import Opportunities data to a OLAP Cube via SQL 2016 SSIS new Odata for Dynamics CRM online.

All Works fine, except that the 'estimatedclosedate' and 'actualclosedate' fields are NULL but they are informed in CRM.

There is not problema with other date fieldas like 'modifiedon' or 'createdon'.

Any idea?

Regards!

Getting Output from Executing Stored Procedure in SSIS

$
0
0

Hi,

Anyone able to help with this:

I have a SQL Stored Procedure with this:

USE [MyDB]
GO

EXEC [dbo].[MyTable]

GO

If I run this is Management Studio it works and returns the following results:

Code (Header)

28

21

89

50

I want to get that list of results and use them in an Email Body within a SSIS Task, but its not working.

In SSIS Control Flow, I do an SQL Execute Task, add the SQL Statement, Resultset= Full Result set

Set the Result set properties: Result Name: 0 and Variable Name: User::MyVariable

But when I run the package, I get error: [Execute SQL Task] Error: Executing the query "USE [MyDB]
" failed with the following error: "No disconnected record set is available for the specified SQL statement.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Any ideas how I resolve this?

I pass nothing to the Stored Procedure, but I want to use the resulting output from the SP pass into the SSIS Package to pass into the Body of the Send Mail Task which comes after this Stored Procedure.

Any help appreciated.


How to run the Insert/Update OLEDB command based on a conditional split that checks Rowcount == 0 in SSIS

$
0
0

The DFT source someday returns no result.So have to insert/update the table based on some default value which is defined in the derived column. As you can see in the attached figure i am using conditional split and checking the Rowcount == 0 if this condition satisfy this will process the OLEDB command where i am using a simple Insert statement

INSERT INTO [dbo].[Invalid]
           (Code]
           ,[Date]
           ,[CreatedDate]
           ,[UpdatedDate])
     VALUES
           (?
           ,?
           ,GETDATE()
           ,GETDATE())

The code and the date value is defined in the derived column and mapped in the OLEDB command column mappings.

the data flow task looks like this

When the Oledb source rowcount > 0 then the value is inserting in the OLEDB destination. but when rowcount = 0 the value is not inserting through OLEDB command. The dataflow task is not returning any error. When i debug the rowcount variable it showing its value as 0 but still it is not doing the insert.

Please let me know how to solve this.

I don't want to use MERGE JOIN/Lookup for this as it is always insert/update single row.

Thanks


DD

transforming 40 million recoords from oracle DB to oracle DB

$
0
0

Hello,

I have large ammount of data.. 40 Million records

my ssis go through each column and clean it..

I used OLEDB Source and Dest

Dest is enabled as Fast Load Option... the operation take almost 4 hours to transfer 40M record...

Some people advaice me to use Oracle Attunity Connectors... but I found the only option is fast load!..

I didnt test the Attunity yet for 40M records.. but

1-which is faster OLEDB fast load or Attunity Fast load... 

2- what is the options in Attunity like "No Logging" and "Parallel Load" and can it Make the load faster?

3-is the 4 hours for 40 million record is good?

thank you

My XSD and XML files

$
0
0

I'm using SSIS to copy data from a XML file.I have a xsd but only read a part of my xml, for example doesn't read the three first elements Date, Name and Phone number, only read the elements contained in info elements. Someone can help me?

This is my XSD

<?xml version="1.0" encoding="utf-8"?>
<!-- Created with Liquid Studio 2019 (https://www.liquid-technologies.com) -->
<xs:schema xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xmlns:s0="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService" xmlns:d="http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:_xdns0="http://schemas.microsoft.com/office/infopath/2003/changeTracking" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:q="http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields" xmlns:ma="http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes" xmlns:tns="http://IBKC.int/" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-06-21T16:04:39" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:dms="http://schemas.microsoft.com/office/2009/documentManagement/types" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-06-21T16:04:39" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import schemaLocation="C:\Users\alfre\OneDrive\Desktop\MaintanceFileDefinition1.xsd" namespace="http://www.w3.org/XML/1998/namespace" />
  <xs:element name="gpDDAMaintenance">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" name="Date" type="xs:date" />
        <xs:element minOccurs="0" name="Name" type="xs:string" />
        <xs:element minOccurs="0" name="PhoneNumber" type="xs:string" />
<xs:element minOccurs="0" name="Info">
         <xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="FormStatus" type="xs:string" />
<xs:element minOccurs="0" name="FormName" type="xs:string" />
<xs:element minOccurs="0" name="FormEmailAddress" type="xs:string" />
<xs:element minOccurs="0" name="EmailAddressOverride" />
<xs:element minOccurs="0" name="DepositWorkflow" type="xs:boolean" />
<xs:element minOccurs="0" name="RateWorkflow" type="xs:boolean" />
<xs:element minOccurs="0" name="HiddenPassword" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
      <xs:attribute ref="xml:lang" use="optional" />
    </xs:complexType>
  </xs:element>
</xs:schema>

This is my XML

<xml version="1.0" encoding="utf-8"?>
<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:XXXXXXmyXSD-2012-06-21T16-04-39" solutionVersion="1.0.20.207" productVersion="16.0.0.0" PIVersion="1.0.0.0" href="aaaa.com?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.4"?>
<?mso-infoPath-file-attachment-present?>
<my:gpDDAMaintenance xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://IBKC.int/" xmlns:_xdns0="http://schemas.microsoft.com/office/infopath/2003/changeTracking" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:s0="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" xmlns:ma="http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes" xmlns:d="http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields" xmlns:q="http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields" xmlns:dms="http://schemas.microsoft.com/office/2009/documentManagement/types" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-06-21T16:04:39" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-US">
<my:Date>2019-05-16</my:Date>
<my:Name>Jhon</my:Name>
<my:PhoneNumber>111-111-1111</my:PhoneNumber>

<my:gpInfo>
<my:FormStatus>Saved</my:FormStatus>
<my:FormName>AAA-157758106D-20190516131812</my:FormName>
<my:FormEmailAddress></my:FormEmailAddress>
<my:EmailAddressOverride></my:EmailAddressOverride>
<my:DepositWorkflow>true</my:DepositWorkflow>
<my:RateWorkflow>false</my:RateWorkflow>
<my:HiddenPassword>asd</my:HiddenPassword>
</my:gpInfo>
</my:gpDDAMaintenance>

Visual Studio 2019 nothing happens when I hit "Edit Script..."

$
0
0

Hello, 

I am using Visual Studio 2019 with new SSIS addon.  I cannot launch a new instance of Visual Studio when I hit "Edit Script..."  in Script Task.
ScriptLanguage shows Microsoft Visual C# 2017 which I do not have installed and it's strange because in Tools -> Options -...  Integration Services Designer under Script language shows Microsoft Visual C# 2019 . 

Anyone else figured this out or it's official you cannot use  Script Tasks in Visual Studio 2019  just yet. 

Thanks

SSIS Package not wanting to fetch metadata of temporary table

$
0
0

Hi this is my first ever attempt at using SISS, so knowledge isn't that great, in fact pure novice.

I simply need to output the results of the SQL Query below into a CSV file into a suitable location, that's it.

I do keep getting error messages though "the metadata could not be determined etc are temp tables allowed in SSIS

NOTE: Not my SQL query

-- PBI 8694 CCIMS Demographics Extract
/*
this generates a dataset of 900k records and takes about 7 mins to run.
right click on results and save as csv.
this saves as csv but without the headers.
use notepad++ to add in headers from file named headers.txt in my docs/jobs/PBI8694 CCIMS Demograhic Extract  on DGLs PC

*/

CREATE TABLE #Example
(
PATIENTOID VARCHAR(50),
address1 VARCHAR(50) NULL,
address2 VARCHAR(50) NULL,
address3 VARCHAR(50) NULL,
address4 VARCHAR(50) NULL,
address5 VARCHAR(50) NULL
);
INSERT INTO 
	#Example ( PATIENTOID, address1, address2, address3, address4, address5)
SELECT 
	pcte.OID,LINE1, LINE2, LINE3, LINE4, LINE5 
FROM 
	LZO_PATIENT AS pcte
LEFT JOIN  -- patient address
	LZO_PATIENTADDRESSROLE AS arcte 
	ON pcte.OID = arcte.IDENTIFYINGOID
	AND arcte.STATUS = 'A'
	AND arcte.ROTYPCODE = 'CC_USUALADD'
	AND arcte.ENDDTTM IS NULL
	AND arcte.OID = 
	(
	SELECT 
		TOP 1 arcte2.OID
	FROM
		LZO_PATIENTADDRESSROLE AS arcte2
	WHERE
		pcte.OID = arcte2.IDENTIFYINGOID
		AND arcte2.STATUS = 'A'
		AND arcte2.ROTYPCODE = 'CC_USUALADD'
		AND arcte2.ENDDTTM IS NULL
	ORDER BY
		arcte2.DATA_START_DATE DESC
	)	
LEFT JOIN -- patient address
	LZO_PATIENTADDRESS AS pacte 
	ON pacte.OID = arcte.ADDRESSOID

WHERE
	--PASID = 'HEY0798884' and
	pcte.STATUS = 'A'
	AND pcte.DEATHDTTM IS NULL
;


WITH Relational
AS
(	/* Unpivot the data into a more relational form, Only return non-empty address entries,	Renumber the addresses in non-empty order */
	SELECT
		U.PATIENTOID
	   ,name = 'address' + CONVERT(CHAR(1),
		ROW_NUMBER() OVER (PARTITION BY U.PATIENTOID ORDER BY U.name))
	   ,U.value
	FROM #Example E
	UNPIVOT (
	value
	FOR name
	IN (E.address1, E.address2, E.address3, E.address4, E.address5)
	) U

	WHERE U.value <> SPACE(0)) ,





--- *************************** concept codes look up defined as common table expression for use in main code
--WITH 


CTE AS
(SELECT 
	b.[DOMAIN], 
	b.[DOMAIN_DESCRIPTION], 
	b.[CONCEPT_CODE], 
	b.[CONCEPT_CODE_DESCRIPTION], 
	b.[HL7_SYNONYM]
FROM
              (
                     SELECT ROW_NUMBER() OVER (PARTITION BY [DOMAIN], [HL7_SYNONYM] ORDER BY [DOMAIN], [HL7_SYNONYM]) AS [Row],
                                  a.[DOMAIN], a.[DOMAIN_DESCRIPTION], a.[CONCEPT_CODE], a.[CONCEPT_CODE_DESCRIPTION], a.[HL7_SYNONYM]
                           FROM
                           (
                                  SELECT vsg.[VALUEDOMAINCODE] DOMAIN
                                         , vd.[DomainDescription] DOMAIN_DESCRIPTION
                                         , cc.[CONCEPTCODE] CONCEPT_CODE
                                         , (STUFF(
                                                (SELECT '#' + [Termtext] 
                                                       FROM [LZO_Term] In_T 
                                                       WHERE VS.[conceptcodeOID] = In_T.[conceptcodeOID] 
                                                              AND In_T.[TRMTPCODE] <> 'Synonym' 
                                                              AND In_T.[Status] = 'A' 
                                                       ORDER BY [Termtext] FOR XML PATH(''), 
                                                       TYPE,ROOT
                                                ).value('root[1]','nvarchar(max)'),1,1,'')) as [CONCEPT_CODE_DESCRIPTION]
                                         , (STUFF(
                                                (SELECT '#' + [Termtext] 
                                                       FROM [LZO_Term] In_T 
                                                       WHERE VS.[conceptcodeOID] = In_T.[conceptcodeOID] 
                                                              and In_T.[TermKey] = 'CSCLRC' 
                                                              and In_T.[Status] = 'A'
                                                       ORDER BY [Termtext] FOR XML PATH(''), 
                                                       TYPE,ROOT
                                                ).value('root[1]','nvarchar(max)'),1,1,'')) as [HL7_SYNONYM]
                                         , cc.[STATUS]+','+vs.[STATUS] CC_VS_STATUS
                                  FROM [LZO_ValueSet] vs
                                         INNER JOIN [LZO_ValueSetGroup] vsg ON (vs.[ValueSetGroupOID] = vsg.[OID]) 
                                         INNER JOIN [LZO_ValueDomain] vd ON (vsg.[ValueDomainOID] = vd.[OID]) 
                                         INNER JOIN [LZO_ConceptCode] cc ON (vs.[conceptcodeoid] = cc.[oid]) 
                                  WHERE 
									vsg.[Code] = 'Default'
                                    AND cc.[STATUS] = 'A' 
                                    AND vs.[STATUS] = 'A'
                           ) AS a
                     ) AS b
                     WHERE [Row] = 1
)
-- *********************** end common table expression


, CTE_NHS AS
(SELECT 
	LOCAL_CODE.LookupValue		AS 'LookupValue1'
	,LOCAL_CODE.[Description]	AS 'Description1'
	,NAT_CODE.LookupValue		AS 'LookupValue2' 
	,NAT_CODE.[Description]		AS 'Description2' 
	,LOOKUP_TYPE.LookupType
FROM 
	tblRefLookup AS LOCAL_CODE
INNER JOIN 
	tblRefLookupCrossMap AS CROSS_MAP
	ON LOCAL_CODE.LookupValueID = CROSS_MAP.FromLookupValueID
INNER JOIN 
	tblRefLookup AS NAT_CODE
	ON CROSS_MAP.ToLookupValueUID = NAT_CODE.[UID]
INNER JOIN 
	tblRefLookupType AS LOOKUP_TYPE
	ON LOCAL_CODE.LookupTypeID = LOOKUP_TYPE.LookupTypeID
WHERE 
	LOOKUP_TYPE.LookupType = 'PAS NHS NUMBER STATUS INDICATOR'
)



SELECT 

	p.PASID								AS 'CasenoteNumber'
	,ISNULL(pid.IDENTIFIER,'')			AS 'NHSNumber'


	,ISNULL(nhsver.LookupValue2,'') AS 'NHSNumberVerificationStatus'

	,''												AS 'MaidenName'
	,ISNULL(p.SURNAME,'')							AS 'Surname'
	,ISNULL(p.MIDDLENAME,'')						AS 'MiddleNames'
	,ISNULL(p.FORENAME,'')							AS 'Forename'

	,ISNULL(cctitle.HL7_SYNONYM,'') AS 'Title'
	
	,ISNULL(CONVERT(VARCHAR(10),BIRTHDTTM,111),'')	AS 'DateOfBirth'
	

	,ISNULL(ccbirthplace.CONCEPT_CODE_DESCRIPTION,'') AS 'Birthplace'
	--,ISNULL(p.PLACEOFBIRTH,'') AS 'Birthplace'

	,ISNULL(CONVERT(VARCHAR(10),DEATHDTTM,111) ,'') AS 'PatientDateOfDeath'
	,''												AS 'PatientDeathIndicator'


	,ISNULL(ccsex.HL7_SYNONYM,'') AS 'Gender'
	,ISNULL(ccethnic.HL7_SYNONYM,'') AS 'EthnicGroup'


	,ISNULL(OCCUPCODE,'')							AS 'Occupation'


	,ISNULL(ccnation.HL7_SYNONYM,'') AS 'Nationality'

	,ISNULL(patel.LINE1,'')							AS 'PhoneHome'
	,ISNULL(pamob.LINE1,'')							AS 'PhoneMobile'
	,ISNULL(pawrk.LINE1,'')							AS 'PhoneWork'


	,ISNULL(ccmarry.HL7_SYNONYM,'') AS 'MartialStatus'
	,ISNULL(ccrelig.HL7_SYNONYM,'') AS 'Religion'


	,ISNULL(SPOKLCODE,'')							AS 'Language' 
	--,ISNULL(pa.LINE1,'')							AS 'AddressLine1'
	--,ISNULL(pa.LINE2,'')							AS 'AddressLine2'
	--,ISNULL(pa.LINE3,'')							AS 'AddressLine3'
	--,ISNULL(pa.LINE4,'') + ' ' + ISNULL(pa.LINE5,'')AS 'AddressLine4'
	--,ISNULL(pa.POSTCODE,'')							AS 'AddressPostcode'
	--,''												AS 'AddressDOR'
	,ISNULL(Add1.[value],'')						AS 'AddressLine1'	
	,ISNULL(Add2.[value],'')						AS 'AddressLine2'	
	,ISNULL(Add3.[value],'')						AS 'AddressLine3'	
	,ISNULL(Add4.[value],'')						AS 'AddressLine4'	
	,ISNULL(pa.POSTCODE,'')							AS 'AddressPostcode'
	,''												AS 'AddressDOR'

	,'GPSurname' = 
	CASE
		WHEN CHARINDEX(' ',gmpgp.ORGANISATION_NAME) > 0 THEN SUBSTRING(gmpgp.ORGANISATION_NAME,1,CHARINDEX(' ',gmpgp.ORGANISATION_NAME) - 1)
		WHEN gmpgp.ORGANISATION_NAME IS NULL THEN ''
		ELSE gmpgp.ORGANISATION_NAME
	END 
	--,gmpgp.ORGANISATION_NAME    these must've been left in for testing
	--,gmpgp.*
	,ISNULL(ORG2.DESCRIPTION,'')						AS 'GPPCT'			
	,ISNULL(pcp.CAREPROVIDERID,'')						AS 'GPCode'			
	,ISNULL(org.MAINIDENTIFIER,'')						AS 'GPPracticeCode'	
	,ISNULL(CONVERT(VARCHAR(10),pcp.STARTDTTM,111),'')	AS 'GPActiveDate' 
	,ISNULL(gmp.ADDRESS_LINE_1,'')						AS 'GPAddressLine1'
	,ISNULL(gmp.ADDRESS_LINE_2,'')						AS 'GPAddressLine2'
	,ISNULL(gmp.ADDRESS_LINE_3,'')						AS 'GPAddressLine3'
	,ISNULL(gmp.ADDRESS_LINE_4,'')						AS 'GPAddressLine4'
	,ISNULL(gmp.POST_CODE,'')							AS 'GPPostcode'
	,'' AS 'GPDOR'			-- district. leave blank

	,'' AS 'NOKTitle'
	,'' AS 'NOKForename'
	,'' AS 'NOKMiddleNames'
	,'' AS 'NOKSurname'
	,'' AS 'NOKRelationship'
	,'' AS 'NOKAddressLine1'
	,'' AS 'NOKAddressLine2'
	,'' AS 'NOKAddressLine3'
	,'' AS 'NOKAddressLine4'
	,'' AS 'NOKPostCode'
	,'' AS 'NOKDOR'
	,'' AS 'NOKPhoneHome'
	,'' AS 'NOKPhoneMobile'
	,'' AS 'NOKPhoneWork'
	,'' AS 'PatientIdentifierList'



FROM
	LZO_PATIENT AS p

LEFT JOIN 
	LZO_PATIENTID AS pid
	ON p.OID = pid.PATIENTOID
	AND pid.PITYPCODE = 'CC_NATNLID'
	AND pid.Status = 'A'
	AND pid.MODIFIEDAT = 
	(
	SELECT	
		TOP 1 pid2.MODIFIEDAT
	FROM
		LZO_PATIENTID AS pid2
	WHERE	
		 p.OID = pid2.PATIENTOID 
		AND pid2.PITYPCODE = 'CC_NATNLID'
		AND pid2.Status = 'A'
	ORDER BY
		pid2.MODIFIEDAT DESC
	)

LEFT JOIN Relational as Add1 on Add1.patientoid = p.OID and Add1.[name] = 'address1'
LEFT JOIN Relational as Add2 on Add2.patientoid = p.OID and Add2.[name] = 'address2'
LEFT JOIN Relational as Add3 on Add3.patientoid = p.OID and Add3.[name] = 'address3'
LEFT JOIN Relational as Add4 on Add4.patientoid = p.OID and Add4.[name] = 'address4'

-- still needed in order to grab postcode
LEFT JOIN   -- patient address
	LZO_PATIENTADDRESSROLE AS ar 
	ON p.OID = ar.IDENTIFYINGOID
	AND ar.STATUS = 'A'
	AND ar.ROTYPCODE = 'CC_USUALADD'
	AND ar.ENDDTTM IS NULL
	AND ar.OID = 
	(
	SELECT 
		TOP 1 ar2.OID
	FROM
		LZO_PATIENTADDRESSROLE AS ar2
	WHERE
		p.OID = ar2.IDENTIFYINGOID
		AND ar2.STATUS = 'A'
		AND ar2.ROTYPCODE = 'CC_USUALADD'
		AND ar2.ENDDTTM IS NULL
	ORDER BY
		ar2.DATA_START_DATE DESC
	)	
LEFT JOIN -- patient address
	LZO_PATIENTADDRESS AS pa 
	ON pa.OID = ar.ADDRESSOID

	
LEFT JOIN   -- patient home tel
	LZO_PATIENTADDRESSROLE AS artel 
	ON p.OID = artel.IDENTIFYINGOID
	AND artel.STATUS = 'A'
	AND artel.ROTYPCODE = 'CC_TELEPHONE'     --= 'CC_AFTERBUSSTEL'
	AND artel.ENDDTTM IS NULL
	AND artel.OID = 
	(
	SELECT 
		TOP 1 artel2.OID
	FROM
		LZO_PATIENTADDRESSROLE AS artel2
	WHERE
		p.OID = artel2.IDENTIFYINGOID
		AND artel2.STATUS = 'A'
		AND artel2.ROTYPCODE = 'CC_TELEPHONE'
		AND artel2.ENDDTTM IS NULL
	ORDER BY
		artel2.DATA_START_DATE DESC
	)
LEFT JOIN -- patient home tel
	LZO_PATIENTADDRESS AS patel 
	ON patel.OID = artel.ADDRESSOID

LEFT JOIN   -- patient mobile
	LZO_PATIENTADDRESSROLE AS armob 
	ON p.OID = armob.IDENTIFYINGOID
	AND armob.STATUS = 'A'
	AND armob.ROTYPCODE = 'CC_MSGMOB'
	AND armob.ENDDTTM IS NULL
	AND armob.OID = 
	(
	SELECT 
		TOP 1 armob2.OID
	FROM
		LZO_PATIENTADDRESSROLE AS armob2
	WHERE
		p.OID = armob2.IDENTIFYINGOID
		AND armob2.STATUS = 'A'
		AND armob2.ROTYPCODE = 'CC_MSGMOB'
		AND armob2.ENDDTTM IS NULL
	ORDER BY
		armob2.DATA_START_DATE DESC
	)
LEFT JOIN -- patient mobile
	LZO_PATIENTADDRESS AS pamob 
	ON pamob.OID = armob.ADDRESSOID
		
LEFT JOIN   -- patient work tel
	LZO_PATIENTADDRESSROLE AS arwrk 
	ON p.OID = arwrk.IDENTIFYINGOID
	AND arwrk.STATUS = 'A'
	AND arwrk.ROTYPCODE = 'CC_WRKTPHONENUM'
	AND arwrk.ENDDTTM IS NULL
	AND arwrk.OID = 
	(
	SELECT 
		TOP 1 arwrk2.OID
	FROM
		LZO_PATIENTADDRESSROLE AS arwrk2
	WHERE
		p.OID = arwrk2.IDENTIFYINGOID
		AND arwrk2.STATUS = 'A'
		AND arwrk2.ROTYPCODE = 'CC_WRKTPHONENUM'
		AND arwrk2.ENDDTTM IS NULL
	ORDER BY
		arwrk2.DATA_START_DATE DESC
	)
LEFT JOIN -- patient work tel
	LZO_PATIENTADDRESS AS pawrk 
	ON pawrk.OID = arwrk.ADDRESSOID

LEFT JOIN  -- GP
	LZO_PATIENTCAREPROVIDER AS pcp
	ON pcp.PATIENTOID = p.OID
	AND pcp.STATUS = 'A'
	AND pcp.ENDDTTM is NULL 
	AND pcp.PRTYPCODE = 'CC_GENPRA1'
	AND pcp.OID = -- removes dupes
	(
	SELECT	
		TOP 1 pcp2.OID
	FROM	
		LZO_PATIENTCAREPROVIDER AS pcp2
	WHERE
		pcp2.PATIENTOID = p.OID
		AND pcp2.STATUS = 'A'
		AND pcp2.ENDDTTM is NULL 
		AND pcp2.CAREPROVIDERID IS NOT NULL
		AND pcp2.PRTYPCODE = 'CC_GENPRA1'
	)

LEFT JOIN	-- GP name
	ODS_GENERAL_MEDICAL_PRACTITIONER AS gmpgp
	ON gmpgp.ORGANISATION_CODE = pcp.CAREPROVIDERID

LEFT JOIN -- GP practice
	LZO_ORGANISATION AS org
	ON org.OID = ORGANISATIONOID
	AND org.STATUS = 'A'

LEFT JOIN  -- GP practice address
	ODS_GENERAL_MEDICAL_PRACTICE AS gmp
	ON gmp.ORGANISATION_CODE = org.MAINIDENTIFIER

LEFT JOIN -- PCT
	LZO_ORGANISATION AS ORG2
    ON org.PARENTORGANISATIONOID = ORG2.OID

LEFT JOIN  -- dummy patients table
	ADD_DummyPatient AS dummy
	ON dummy.LOCAL_PATIENT_NUMBER = p.PASID

/* concept codes joins */
LEFT JOIN
	CTE AS cctitle
	ON cctitle.DOMAIN = 'TITLE'
	AND cctitle.CONCEPT_CODE = p.TITLECODE
LEFT JOIN
	CTE AS ccbirthplace
	ON ccbirthplace.DOMAIN = 'CITYCODE'
	AND ccbirthplace.CONCEPT_CODE = p.PLACEOFBIRTH
LEFT JOIN
	CTE AS ccsex
	ON ccsex.DOMAIN = 'SEXXX'
	AND ccsex.CONCEPT_CODE = p.SEXXXCODE
LEFT JOIN
	CTE AS ccethnic
	ON ccethnic.DOMAIN = 'ETHNGRP'
	AND ccethnic.CONCEPT_CODE = p.ETHGRCODE
LEFT JOIN
	CTE AS ccnation
	ON ccnation.DOMAIN = 'NATIONALITY'
	AND ccnation.CONCEPT_CODE = p.NATNLCODE
LEFT JOIN
	CTE AS ccmarry
	ON ccmarry.DOMAIN = 'MARITALSTATUS'
	AND ccmarry.CONCEPT_CODE = p.MARRYCODE
LEFT JOIN
	CTE AS ccrelig
	ON ccrelig.DOMAIN = 'RELIG'
	AND ccrelig.CONCEPT_CODE = p.RELIGCODE

/* nhs number verification status*/
LEFT JOIN
	CTE_NHS AS nhsver
	ON nhsver.lookupValue1 = p.PTRSTCODE

	
WHERE
	--p.PASID = 'HEY0798884' and

	p.STATUS = 'A'
	AND DEATHDTTM IS NULL
	AND dummy.LOCAL_PATIENT_NUMBER IS NULL
	
	--and LZO_PATIENTID.IDENTIFIER is not null   -- just for testing





/*
4 dupes LZO_PATIENTID
HEY3051715
HEY3142954
HEY3142341
HEY3143543

LEFT JOIN 
	LZO_PATIENTID AS pid
	ON p.OID = pid.PATIENTOID 
	AND pid.PITYPCODE = 'CC_NATNLID'
	AND pid.Status = 'A'
*/




SSIS Fast Load Doesn't Work on SSIS CATALOG For OLEDB Dest

$
0
0

Hello..

I have a package that I used OLEDB fast load dest...

and it work fine in ssis Data tool

its a fast load destination

 

but when I deployed it to SSIS catalog and run it... it gave me error

sI read about the error and a lot of people talking about validationdelay property to be set to true

and I did it 

and still give the same error .. any help Its critical to me

Package failing with compatability error

$
0
0

I have posted earlier that i wanted to add a WHERE clause for  a Variable expression , the solution worked fine but the package failed

Original Post:

Hi All

I have a package in which the source is a (SQL Command from variable).

The expression and the evaluated values are like below

"select "+@[User::SourceColumns]+" from "+@[User::SourceTable]+";"


Select empid,empdate

from dbo.ecoemp

Now i want to limit the data for the past 180 days

How can i add the (where datediff(dd,empdate,getdate())<=180

in the expression.

But now the package is failing with the below error

Insert New or Changed Records:Error: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E14.
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80040E14  Description: "Statement(s) could not be prepared.".
An OLE DB record is available.  Source: "Microsoft SQL Server Native Client 11.0"  Hresult: 0x80040E14  Description: ""dd" is not a recognized table hints option. If it is intended as a parameter to a table-valued function or to the CHANGETABLE function, ensure that your database compatibility mode is set to 90.".

My VS Version is 

Microsoft SQL Server Data Tools for Visual Studio 2017  (SSDT)
Version 15.9.11
VisualStudio.15.Release/15.9.11+28307.586
Microsoft .NET Framework
Version 4.8.03752

Installed Version: IDE Standard

Microsoft Visual Studio Tools for Applications 2017   00371-40000-00001-AA993
Microsoft Visual Studio Tools for Applications 2017

C# Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

NuGet Package Manager   4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Project   1.0
Information about my package

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

SQL Server Analysis Services   15.0.1572.0
Microsoft SQL Server Analysis Services Designer 
Version 15.0.1572.0

SQL Server Data Tools   15.1.61903.01040
Microsoft SQL Server Data Tools

SQL Server Integration Services   
Microsoft SQL Server Integration Services Designer
Version 15.0.1100.123

SQL Server Reporting Services   15.0.1528.0
Microsoft SQL Server Reporting Services Designers 
Version 15.0.1528.0

SsmsVsIntegration   1.0
Information about my package

Visual Basic Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Please advice

should i change the compatibility as it will affect the other packages

Thanks

how to handle Connection failure errors in SSIS packages

$
0
0

Hello All,

Actual Work of my package: in my SSis package what i am doing is from loading DB from one db to another (so i have source connection, destination connection and some file connection in my connection manager)

i have a send mail task in my events (when package fails, it send a mail) it is working fine.

but now the problem is when ever it is unable to connect to source DB (such as Source connection manager DB is unable to connect ) then it is not throwing any error

how can i make my package, that returns even this kind of fail overs

please help me, Thanks in adavnce

Best Regards
Dhani


 

Saving Copy of Package to SQL Server - Permanently Save Database Name, Username and Password?

$
0
0

Using VS 2012, and saving packages to SQL Server. My question is about the "Save Copy of Package" dialog box. I use the same settings for every package:

Package location: SQL Server

Server: [Server Instance Name]

Authentication Type: SQL Server Authentication

Protection Level: Rely on server storage and roles for access control

Is it possible to permanently save any of these values? And for SQL Server authentication is it possible to store the username and password so I don't have to enter them every time I save a package? My SQL Server password has to be changed periodically (company policy) and opening each individual package and keying all this in is very cumbersome.

Visual Studio Crashing when running SSIS Package

$
0
0

I was able to run the SSIS Package before but it suddenly crashes Visual Studio now. Restarting VS/Computer didn't help. Coworker checked out the same code and was able to run it fine. Below are the event logs. Haven't tried uninstalling VS/ SSDT yet, wanted to avoid doing that.

Any help is appreciated, thanks.


-System


-Provider
[ Name]ESENT
-EventID 325
[ Qualifiers]0
Level4
Task1
Keywords0x80000000000000
-TimeCreated
[ SystemTime]2019-11-04T21:57:43.255402700Z
EventRecordID49059
ChannelApplication
ComputerLAPTOP-5IRK5G3Q
Security
-EventData
devenv
9352,D,35
3951248b-0520-41ad-bc79-90c899a80606:
1
C:\Users\tamng\AppData\Local\Temp\5e6d7ea4-e533-470f-98fe-21aa3ecbfd17.model
0
[1] 0.001321 +J(0) +M(C:0K, Fs:5, WS:20K # 4K, PF:8K # 0K, P:8K) [2] 0.000003 +J(0) [3] 0.005870 -0.000004 (3) WT +J(0) +M(C:0K, Fs:32, WS:120K # 128K, PF:20K # 0K, P:20K) [4] 0.001350 +J(0) [5] 0.000150 +J(CM:0, PgRf:3, Rd:0/0, Dy:3/3, Lg:0/0) +M(C:0K, Fs:21, WS:84K # 76K, PF:128K # 44K, P:128K) [6] 0.002685 +J(CM:0, PgRf:226, Rd:0/0, Dy:22/214, Lg:0/0) +M(C:0K, Fs:109, WS:424K # 424K, PF:356K # 356K, P:356K) [7] 0.000006 +J(0) [8] 0.000001 +J(0) [9] 0.007956 -0.006551 (3) WT +J(0) +M(C:-44K, Fs:27, WS:-256K # 12K, PF:-404K # 8K, P:-404K) [10] 0.001106 -0.000050 (2) WT +J(CM:0, PgRf:352, Rd:0/0, Dy:11/46, Lg:0/0) +M(C:12K, Fs:50, WS:140K # 0K, PF:56K # 0K, P:56K) [11] 0.000003 +J(0).
0 0


-System
-Provider
[ Name]ESENT
-EventID 105
[ Qualifiers]0
Level4
Task1
Keywords0x80000000000000
-TimeCreated
[ SystemTime]2019-11-04T21:57:43.215723000Z
EventRecordID49057
ChannelApplication
ComputerLAPTOP-5IRK5G3Q
Security
-EventData
devenv
9352,D,0
3951248b-0520-41ad-bc79-90c899a80606:
0
0
[1] 0.001701 +J(0) +M(C:0K, Fs:535, WS:2112K # 1876K, PF:3568K # 1860K, P:3568K) [2] 0.001235 +J(0) +M(C:32768K, Fs:216, WS:792K # 792K, PF:33668K # 33660K, P:33668K) [3] 0.000017 +J(0) +M(C:0K, Fs:1, WS:4K # 4K, PF:64K # 64K, P:64K) [4] 0.004593 +J(0) +M(C:0K, Fs:25, WS:44K # 84K, PF:140K # 140K, P:140K) [5] 0.001505 +J(0) +M(C:0K, Fs:5, WS:20K # 0K, PF:0K # 0K, P:0K) [6] - [7] - [8] - [9] - [10] - [11] - [12] - [13] 0.031720 +J(0) +M(C:0K, Fs:18, WS:40K # 48K, PF:-152K # 0K, P:-152K) [14] 0.000021 +J(0) +M(C:0K, Fs:3, WS:12K # 0K, PF:0K # 0K, P:0K) [15] 0.000064 +J(0) +M(C:0K, Fs:16, WS:64K # 48K, PF:64K # 0K, P:64K) [16] 0.000002 +J(0).
-System
-Provider
[ Name]ESENT
-EventID 102
[ Qualifiers]0
Level4
Task1
Keywords0x80000000000000
-TimeCreated
[ SystemTime]2019-11-04T21:57:43.212251000Z
EventRecordID49056
ChannelApplication
ComputerLAPTOP-5IRK5G3Q
Security
-EventData
devenv
9352,P,98
3951248b-0520-41ad-bc79-90c899a80606:
0
10
00
17763
0000
-System
-Provider
[ Name]Windows Error Reporting
-EventID 1001
[ Qualifiers]0
Level4
Task0
Keywords0x80000000000000
-TimeCreated
[ SystemTime]2019-11-04T21:57:38.234706100Z
EventRecordID49055
ChannelApplication
ComputerLAPTOP-5IRK5G3Q
Security
-EventData
1409585273951575686
1
APPCRASH
Not available
0
devenv.exe
15.9.28307.770
5d1a5d5e
msexcl40.dll
4.0.9801.17
5d1844dd
c0000005
0000bb80
\\?\C:\Users\tamng\AppData\Roaming\microsoft\visualstudio\15.0_4448e455\activitylog.xml \\?\C:\Users\tamng\AppData\Local\microsoft\visualstudio\15.0_4448e455\devenv.exe.config \\?\C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.isolation.ini \\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERB3F8.tmp.dmp \\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERD675.tmp.WERInternalMetadata.xml \\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERD6A5.tmp.xml \\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERD6B3.tmp.csv \\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WERD6D3.tmp.txt
\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_devenv.exe_ddf4c25893e2a53da216e8fec2d13cc24835685_e0e9d5ae_0edfe6b1
0
9bca2295-77b2-425a-a22d-ea5f25b38501
268435456
05e66b43169fdf35538fda569e815e86
0
-System
-Provider
[ Name]Application Error
-EventID 1000
[ Qualifiers]0
Level2
Task100
Keywords0x80000000000000
-TimeCreated
[ SystemTime]2019-11-04T21:57:24.355613900Z
EventRecordID49054
ChannelApplication
ComputerLAPTOP-5IRK5G3Q
Security
-EventData
devenv.exe
15.9.28307.770
5d1a5d5e
msexcl40.dll
4.0.9801.17
5d1844dd
c0000005
0000bb80
22b0
01d5935a20f0155c
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\devenv.exe
C:\Windows\System32\msexcl40.dll
9bca2295-77b2-425a-a22d-ea5f25b38501
-System
-Provider
[ Name].NET Runtime
-EventID 1026
[ Qualifiers]0
Level2
Task0
Keywords0x80000000000000
-TimeCreated
[ SystemTime]2019-11-04T21:57:22.939660700Z
EventRecordID49053
ChannelApplication
ComputerLAPTOP-5IRK5G3Q
Security
-EventData
Application: devenv.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: exception code c0000005, exception address 2783BB80 Stack: 

Viewing all 24688 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>