Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IN Conversion (Oracle -> SQL Server) #50

Open
kfordaccela opened this issue Oct 15, 2019 · 1 comment
Open

IN Conversion (Oracle -> SQL Server) #50

kfordaccela opened this issue Oct 15, 2019 · 1 comment

Comments

@kfordaccela
Copy link

For “Oracle” to “SQL Server” the “IN” is getting replaced with “dbo.IN” which isn’t going to work, trying to do many conversions and would like to use the command line tool instead of the online version.

Test version SQLines 3.1.113 - Windows 32-bit, 5.3 MB, July 02, 2018
(^^ is there a newer build for windows?)

Online converter works without issue without creating correct output.

Input

WITH George AS (SELECT B.*
FROM TABLE1 B
	INNER JOIN TABLE2 T2 ON
		1=1
		AND T2.AGENCY = B.AGENCY
		AND T2.REC_GROUP = B.REC_GROUP
		AND T2.REC_TYPE = B.REC_TYPE
		AND T2.REC_SUB_TYPE = B.REC_SUB_TYPE
		AND T2.REC_CATEGORY = B.REC_CATEGORY
		AND T2.REC_GROUP IN ('1','2','3','4')
		AND T2.REC_TYPE IN ('1','2','3','4')
		AND
		(
			(
				T2.REC_GROUP       ||
				'/'                  ||
					T2.REC_TYPE    ||
				'/'                  ||
					T2.REC_SUB_TYPE||
				'/'                  ||
					T2.REC_CATEGORY IN ( '1','2','3','4' )
			)
			OR
			(
				T2.REC_GROUP||
				'/'           ||
					T2.REC_TYPE = 'GEORGE'
			)
		)
WHERE
	1=1
	AND B.AGENCY = (SELECT AGENCY FROM PARAMS)
	AND UPPER(B.B1_ALT_ID) = (SELECT capid FROM PARAMS)
)
SELECT * FROM GEORGE

Output:

WITH George AS (SELECT B.*
FROM TABLE1 B
	INNER JOIN TABLE2 T2 ON
		1=1
		AND T2.AGENCY = B.AGENCY
		AND T2.REC_GROUP = B.REC_GROUP
		AND T2.REC_TYPE = B.REC_TYPE
		AND T2.REC_SUB_TYPE = B.REC_SUB_TYPE
		AND T2.REC_CATEGORY = B.REC_CATEGORY
		AND T2.REC_GROUP dbo.IN ('1','2','3','4')
		AND T2.REC_TYPE dbo.IN ('1','2','3','4')
		AND
		(
			(
				ISNULL(T2.REC_GROUP, '')       +
				'/'                  +
					ISNULL(T2.REC_TYPE, '')    +
				'/'                  +
					ISNULL(T2.REC_SUB_TYPE, '')+
				'/'                  +
					ISNULL(T2.REC_CATEGORY, '') dbo.IN ( '1','2','3','4' )
			)
			OR
			(
				ISNULL(T2.REC_GROUP, '')+
				'/'           +
					ISNULL(T2.REC_TYPE, '') = 'GEORGE'
			)
		)
WHERE
	1=1
	AND B.AGENCY = (SELECT AGENCY FROM PARAMS)
	AND UPPER(B.B1_ALT_ID) = (SELECT capid FROM PARAMS)
)
SELECT * FROM GEORGE
@kfordaccela
Copy link
Author

Unable to compile newer version since the build script is broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant