Questions Tagged With database_conversionhttps://answers.axonivy.com/tags/database_conversion/?type=rssquestions tagged <span class="tag">database_conversion</span>enFri, 01 Jul 2016 10:56:57 -0400Using local temporary tablehttps://answers.axonivy.com/questions/1856/using-local-temporary-table<p>Hello Every body!</p> <p>Look at the bellow picture, I have 2 database steps: 1. For the first step, it'll create a LOCAL temporary table and store the data in this table (For ex: It is named '#SUPERIOR') 2. The seconds step, it'll get data from '#SUPERIOR'</p> <p>But, we have some strange behaviors that sometimes it can not get data from '#SUPERIOR' temporary table. I guess that the '#SUPERIOR' is already dropped (because connection is closed --&gt; local temporary table is dropped) before step 2 is executed.</p> <p>Our application have a lot of users that can access concurrency (more than 1000 users)</p> <p>Could you pls give me some ideas?</p> <p>Thanks for your help!</p> <p><strong>This is sample of step1:</strong></p> <pre><code> Declare @ORSID int =1; DECLARE @EMPKEY int = 20018; DECLARE @CONNUMB varchar = '1'; DECLARE @SUPERIORORLID int = 1; DECLARE @PARENTID int = 0; IF OBJECT_ID('tempdb..#SUPERIORORGTREEANDROLE_eRAP20018') IS NOT NULL DROP TABLE #SUPERIORORGTREEANDROLE_eRAP20018 DECLARE @ORGTREEANDROLE TABLE( ORGID INT, ORGPNTOU INT, ORGCHDOU INT,ORSID INT, OUNDESC varchar(MAX), OUNTYPE varchar(MAX), ASNID INT, EMPKEY INT, CONNUMB varchar(MAX), ASNMAIN varchar(MAX), ORLID INT ); INSERT INTO @ORGTREEANDROLE SELECT org.ORGID, org.ORGPNTOU, org.ORGCHDOU, org.ORSID, ounc.OUNDESC, ounc.OUNTYPE, asnc.ASNID, asnc.EMPKEY, asnc.CONNUMB, asnc.ASNMAIN, asr.ORLID FROM HRMORG org LEFT OUTER JOIN HRMOUN ounc ON ounc.OUNKEY = org.ORGCHDOU LEFT OUTER JOIN HRMASN asnc ON asnc.OUNKEY = ounc.OUNKEY and asnc.ASNFROM &lt;= CONVERT(DATE, GETDATE()) and asnc.ASNUNTIL &gt;= CONVERT(DATE, GETDATE()) LEFT OUTER JOIN HRMASR asr ON asr.ASNID = asnc.ASNID WHERE org.ORSID = @ORSID and ounc.OUNFROM &lt;= CONVERT(DATE, GETDATE()) and ounc.OUNUNTIL &gt;= CONVERT(DATE, GETDATE()) ORDER BY org.ORGID SELECT @PARENTID = orgTree.ORGPNTOU FROM @ORGTREEANDROLE orgTree WHERE orgTree.CONNUMB = @CONNUMB AND orgTree.EMPKEY = @EMPKEY AND orgTree.ASNMAIN = 'Y' DECLARE @COUNT INT = 0; WHILE (@COUNT &lt; 20) BEGIN SET @COUNT = @COUNT + 1; IF (@PARENTID = 0 OR @PARENTID = NULL ) BEGIN BREAK; END ELSE BEGIN IF ((SELECT COUNT(ORGID)FROM @ORGTREEANDROLE orgTree WHERE orgTree.ORGCHDOU = @PARENTID AND orgTree.ORLID = @SUPERIORORLID) &gt; 0) BEGIN SELECT orgTree.EMPKEY, orgTree.CONNUMB, orgTree.ORGCHDOU ,orgTree.ASNID INTO #SUPERIORORGTREEANDROLE_eRAP20018 FROM @ORGTREEANDROLE orgTree WHERE orgTree.ORGCHDOU = @PARENTID AND orgTree.ORLID = @SUPERIORORLID BREAK; END END SELECT @PARENTID = orgTree.ORGPNTOU FROM @ORGTREEANDROLE orgTree WHERE orgTree.ORGCHDOU = @PARENTID END </code> </pre> <p>This is the sample for step2: </p><pre><code> SELECT * FROM #SUPERIORORGTREEANDROLE_eRAP20018; </code> </pre><p></p> <p><img alt="alt text" src="http://answers.axonivy.com/upfiles/process_getsuperior.png"></p> <p>Regards,</p>Hap EmFri, 01 Jul 2016 10:56:57 -0400https://answers.axonivy.com/questions/1856/using-local-temporary-tabledatabase_conversionivyStoring DateTime in databasehttps://answers.axonivy.com/questions/1238/storing-datetime-in-database<p>Hello,</p> <p>we use database (sqlserver) to store values. One of those field is an ivy DateTime. When we try to store it in the database we have this error :</p> <p>com.microsoft.sqlserver.jdbc.SQLServerException: The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)</p> <p>The ivy field is a ch.ivyteam.ivy.scripting.objects.DateTime and it must be stored in a smalldatetime filed from sqlserver (10.50.4000.0).</p> <p>What are we doing wrong ?</p>dbalasseMon, 23 Mar 2015 17:45:22 -0400https://answers.axonivy.com/questions/1238/storing-datetime-in-databasedatabase_conversionDatabase conversion stays forever on "SET READ_COMMITTED_SNAPSHOT ON"https://answers.axonivy.com/questions/875/database-conversion-stays-forever-on-set-read_committed_snapshot-on<p>If I convert the Ivy System Database from version 4.2 (Database version 25) to 4.3 (DB version 30) or newer the conversion stays forever on (is blocked on) the task "<code>SET READ_COMMITTED_SNAPSHOT ON</code>".<br> The conversion dialog looks like this:<img alt="SET READ_COMMITTED_SNAPSHOT ON" src="/upfiles/conversion_blocked_on_set_read_committed_snapshot.png"> What is wrong? Is my database to big? Is there any fix or workaround?</p>SupportIvyTeamMon, 21 Jul 2014 17:30:15 -0400https://answers.axonivy.com/questions/875/database-conversion-stays-forever-on-set-read_committed_snapshot-ondatabase_conversion