Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

-1 votes
1 answers
253 views
How to combine table 2 value in table 1 where id field is same?
Table 1 | id | name | coupn | | ----- | ----- | ----- | | PR001 | DC001 | 5 | | PR002 | DC001 | 5 | | PR003 | DC001 | 6 | | PR004 | DC002 | 7 | | PR005 | DC003 | 3 | | PR006 | DC003 | 11 | | PR007 | DC004 | 10 | | PR008 | DC005 | 66 | Table 2 | id | name | bonus | | ----- | ---- | ----: | | PR001 |...
Table 1 | id | name | coupn | | ----- | ----- | ----- | | PR001 | DC001 | 5 | | PR002 | DC001 | 5 | | PR003 | DC001 | 6 | | PR004 | DC002 | 7 | | PR005 | DC003 | 3 | | PR006 | DC003 | 11 | | PR007 | DC004 | 10 | | PR008 | DC005 | 66 | Table 2 | id | name | bonus | | ----- | ---- | ----: | | PR001 | res | 10 | | PR002 | des | 2 | | PR003 | DC | 1 | | PR004 | Drf | 7 | | PR005 | wed | 3 |
Rk Itsolution (1 rep)
Feb 19, 2020, 07:42 PM • Last activity: May 27, 2025, 05:43 AM
1 votes
1 answers
1898 views
Importing a Foxpro Database
I have a Fox Pro database (one DBC and a bunch of DBF files) that I want to import into SQL via the Import and Export wizard. I downloaded the FoxPro ODBC driver. I managed to get to the screen that shows all table name. I can even preview the data, except if I try to go next I will get Column infor...
I have a Fox Pro database (one DBC and a bunch of DBF files) that I want to import into SQL via the Import and Export wizard. I downloaded the FoxPro ODBC driver. I managed to get to the screen that shows all table name. I can even preview the data, except if I try to go next I will get Column information for the source and the destination data could not be retrieved, or the data types of source columns were not mapped correctly to those available on the destination provider. >"somecolumn" -> [dbo].[somecolumn]: > >- Cannot load the column attributes from the schema using the current provider descriptor: > >The column attribute "ORDINAL_POSITION" is not valid. > >Please verify the ProviderDescriptors.xml file contains the data provider descriptor that matches the schema of the used data provider. I understand I need to fix the ProviderDescriptors.xml file, which has this line OrdinalPositionColumnName="ORDINAL_POSITION" But what can I put in there? I have guessed the following - POSITION - ORDINALPOSITION - ID - INDEX - OFFSET All of the above doesn't work.
elty123 (431 rep)
Dec 4, 2014, 10:21 PM • Last activity: Aug 12, 2024, 07:29 PM
0 votes
1 answers
733 views
Exporting FoxPro DBF Files
I am attempting to export data stored by a client's Visual FoxPro database to be used in a MySQL context. The data given is a folder of .dbf, .cdx, and .tbk files, as well as a few .dct, .dcx, and .dbc files. I have access to the directory with the files, but I do not have access to FoxPro. I have t...
I am attempting to export data stored by a client's Visual FoxPro database to be used in a MySQL context. The data given is a folder of .dbf, .cdx, and .tbk files, as well as a few .dct, .dcx, and .dbc files. I have access to the directory with the files, but I do not have access to FoxPro. I have tried opening them with dBASE, which has been more supported and is supposed to be able to read DBF files, but that was to no avail: dBASE kept claiming that there were corrupted table/index headers, which prevented it from opening the DBF files even when in the same directory as the associated CDX files. I have tried opening them with data recovery tools to see what I could gather, and those appear to show strings stored in the rows, but due to what I believe is an encoding issue, they're surrounded by gibberish and not well organized. I have even tried opening them with spreadsheet tools like LibreOffice, but they gave similar results. Are there any other tools or methods I can attempt to get the data from these files and store them in a more modern format? I tried obtaining FoxPro, but it refuses to run on my version of Windows 10 due to its discontinuation. I appreciate any assistance or advice that you can give. Thank you in advance!
Eli (101 rep)
Oct 21, 2022, 07:57 PM • Last activity: Apr 4, 2024, 02:06 PM
1 votes
0 answers
192 views
.DBC (FoxPro DBF) > FoxPro ODBC Driver > MIDDLEWARE > SaaS
I've been searching for Visual FoxPro ODBC Driver and finally found it. I am using a middleware to connect a .DBC (foxpro) > MIDDLEWARE > SaaS. I see from postings on MSDN that Microsoft suggests using OLEDB instead of ODBC, however I'm trying to interface a data source with an application that conn...
I've been searching for Visual FoxPro ODBC Driver and finally found it. I am using a middleware to connect a .DBC (foxpro) > MIDDLEWARE > SaaS. I see from postings on MSDN that Microsoft suggests using OLEDB instead of ODBC, however I'm trying to interface a data source with an application that connects to data sources using ODBC connections. Would this be possible?
John (51 rep)
Jun 24, 2016, 08:01 AM
0 votes
1 answers
1412 views
The number of records that is the table shows in .dbf file is not match with the real number of records
I have some .dbf files made in VFP. I have to work with them and occasionally edit it. Recently I noticed that one of .dbf`s is running in a wrong way. The number of records that is the table shows is not match with the real number of records. I have tried to modify the header of this table to refle...
I have some .dbf files made in VFP. I have to work with them and occasionally edit it. Recently I noticed that one of .dbf`s is running in a wrong way. The number of records that is the table shows is not match with the real number of records. I have tried to modify the header of this table to reflect an estimated number of records but with no result. How can I get my origin files back?
Tamarin-Fly (3 rep)
Feb 3, 2015, 02:07 PM • Last activity: Feb 7, 2015, 04:28 PM
1 votes
2 answers
407 views
Can I safely delete .tmp files from a FoxPro 2.5?
Can I safely delete `.tmp` files from a FoxPro 2.5 application? There are currently over 71k `.tmp` files. They are located in the root directory and the `\TEMP` directory.
Can I safely delete .tmp files from a FoxPro 2.5 application? There are currently over 71k .tmp files. They are located in the root directory and the \TEMP directory.
Corey (131 rep)
Apr 29, 2014, 07:23 PM • Last activity: May 5, 2014, 07:36 PM
1 votes
2 answers
1680 views
Get row from table for last date before date parameter if no row for date parameter or entries null
I have table, which holds the exchange rates for currencies. There is also a `Date` column, which holds the currency exchange rates acquisition date. For some dates there is a row, but no currency exchange rates and for some dates there is no row in that table. To get the currency exchange rates for...
I have table, which holds the exchange rates for currencies. There is also a Date column, which holds the currency exchange rates acquisition date. For some dates there is a row, but no currency exchange rates and for some dates there is no row in that table. To get the currency exchange rates for a specific date, I need to pass the date as parameter. SELECT documentHead.r_art AS documentHeadDocClass, foreignCurrency.usd_brief AS foreignCurrencyUSDAsk, foreignCurrency.usd_geld AS foreignCurrencyUSDBid, foreignCurrency.chf_brief AS foreignCurrencyCHFAsk, foreignCurrency.chf_geld AS foreignCurrencyCHFBid, foreignCurrency.gbp_brief AS foreignCurrencyGBPAsk, foreignCurrency.gbp_geld AS foreignCurrencyGBPBid, foreignCurrency.jpy_brief AS foreignCurrencyJPYAsk, foreignCurrency.jpy_geld AS foreignCurrencyJPYBid, documentListPeriods.id AS documentPeriodsID, documentListPeriods.von AS documentPeriodsFrom, documentListPeriods.bis AS documentPeriodsTo, documentListPeriods.tage AS documentPeriodsDays, documentListPeriods.rate AS documentPeriodsRate, documentListPeriods.wert AS documentPeriodsWorth FROM ( SELECT documentPeriods.id AS documentPeriodsID, documentPeriods.von AS documentPeriodsFrom, documentPeriods.bis AS documentPeriodsTo, documentPeriods.tage AS documentPeriodsDays, documentPeriods.rate AS documentPeriodsRate, documentPeriods.wert AS documentPeriodsWorth FROM comperiode AS documentPeriods WHERE documentPeriods.id = 1 ) AS documentListPeriods INNER JOIN tckopf AS documentHead ON documentHead.id = 1 LEFT OUTER JOIN devisen AS foreignCurrency ON foreignCurrency.datum = documentHead.datum How can I get a currency exchange rates table row, where the currency exchange rates exists and the date is equal to the passed date parameter or the last date before the passed date parameter? The problem is: LEFT OUTER JOIN devisen AS foreignCurrency ON foreignCurrency.datum = documentHead.datum if the row for foreignCurrency.datum not exists or the currency exchange rates are NULL. If I use LEFT OUTER JOIN devisen AS foreignCurrency ON foreignCurrency.datum <= documentHead.datum I get all less than foreignCurrency.datum, but I only need the newest row. In the following example there are missing rows for a date or a row where are all columns are NULL.: currencies exchange rates with missing values for a date If documentHead.datum is 2009-08-09 and there is no row for that date, I need newest row before. In that case the row for 2009-08-07. I tried to use TOP 1 and a rewrite for the LEFT OUTER JOIN like the following.: SELECT documentHead.r_art AS documentHeadDocClass, foreignCurrency.usd_brief AS foreignCurrencyUSDAsk, foreignCurrency.usd_geld AS foreignCurrencyUSDBid, foreignCurrency.chf_brief AS foreignCurrencyCHFAsk, foreignCurrency.chf_geld AS foreignCurrencyCHFBid, foreignCurrency.gbp_brief AS foreignCurrencyGBPAsk, foreignCurrency.gbp_geld AS foreignCurrencyGBPBid, foreignCurrency.jpy_brief AS foreignCurrencyJPYAsk, foreignCurrency.jpy_geld AS foreignCurrencyJPYBid, documentListPeriods.id AS documentPeriodsID, documentListPeriods.von AS documentPeriodsFrom, documentListPeriods.bis AS documentPeriodsTo, documentListPeriods.tage AS documentPeriodsDays, documentListPeriods.rate AS documentPeriodsRate, documentListPeriods.wert AS documentPeriodsWorth FROM ( SELECT documentPeriods.id AS documentPeriodsID, documentPeriods.von AS documentPeriodsFrom, documentPeriods.bis AS documentPeriodsTo, documentPeriods.tage AS documentPeriodsDays, documentPeriods.rate AS documentPeriodsRate, documentPeriods.wert AS documentPeriodsWorth FROM comperiode AS documentPeriods WHERE documentPeriods.id = $P{document_id} ) AS documentListPeriods INNER JOIN tckopf AS documentHead ON documentHead.id = $P{document_id} LEFT OUTER JOIN ( SELECT TOP 1 foreignCurrency.usd_brief AS foreignCurrencyUSDAsk, foreignCurrency.usd_geld AS foreignCurrencyUSDBid, foreignCurrency.chf_brief AS foreignCurrencyCHFAsk, foreignCurrency.chf_geld AS foreignCurrencyCHFBid, foreignCurrency.gbp_brief AS foreignCurrencyGBPAsk, foreignCurrency.gbp_geld AS foreignCurrencyGBPBid, foreignCurrency.jpy_brief AS foreignCurrencyJPYAsk, foreignCurrency.jpy_geld AS foreignCurrencyJPYBid FROM devisen AS foreignCurrency WHERE foreignCurrency.datum <= documentHead.$P!{exchangeRateTiming} AND foreignCurrency.datum IS NOT NULL AND foreignCurrency.usd_brief IS NOT NULL AND foreignCurrency.usd_geld IS NOT NULL AND foreignCurrency.chf_brief IS NOT NULL AND foreignCurrency.chf_geld IS NOT NULL AND foreignCurrency.gbp_brief IS NOT NULL AND foreignCurrency.gbp_geld IS NOT NULL AND foreignCurrency.jpy_brief IS NOT NULL AND foreignCurrency.jpy_geld IS NOT NULL ORDER BY foreignCurrency.datum DESC ) AS foreignCurrency But then I get a null pointer exception in iReport.: Error filling print... Error executing SQL statement for : boss_charterfaktura_document_list_interval_positions Setting up the file resolver...  net.sf.jasperreports.engine.JRException: Error executing SQL statement for : boss_charterfaktura_document_list_interval_positions      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:246)      at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1086)      at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:667)      at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1253)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:877)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:822)      at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:61)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745)      at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891)      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)  Caused by: java.sql.SQLException: java.lang.NullPointerException      at com.hxtt.sql.dl.a(Unknown Source)      at com.hxtt.sql.c3.a(Unknown Source)      at com.hxtt.sql.aj.else(Unknown Source)      at com.hxtt.sql.aj.cm(Unknown Source)      at com.hxtt.sql.aj.s(Unknown Source)      at com.hxtt.sql.dl.a(Unknown Source)      at com.hxtt.sql.dl.a(Unknown Source)      at com.hxtt.sql.el.a(Unknown Source)      at com.hxtt.sql.dl.a(Unknown Source)      at com.hxtt.sql.br.a(Unknown Source)      at com.hxtt.sql.ai.a(Unknown Source)      at com.hxtt.sql.dn.executeQuery(Unknown Source)      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:239)      at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1086)      at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:667)      at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1253)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:877)      at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:822)      at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:61)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:446)      at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:276)      at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:745)      at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:891)      at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)      at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)        at com.hxtt.global.SQLState.SQLException(Unknown Source)      at com.hxtt.sql.br.a(Unknown Source)      at com.hxtt.sql.ai.a(Unknown Source)      at com.hxtt.sql.dn.executeQuery(Unknown Source)      at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:239)      ... 12 more  Print not filled. Try to use an EmptyDataSource... How can I achieve that in SQL?
BuZZ-dEE (131 rep)
Feb 25, 2014, 03:33 PM • Last activity: Feb 26, 2014, 11:15 AM
0 votes
3 answers
2203 views
How to IFNULL or COALESCE rewrite in a SQL query?
I there a way to rewrite a SQL query, so I can avoid `IFNULL` or `COALESCE`, because the HXTT DBF JDBC driver (supports SQL92) throws the following error.: Caused by: java.sql.SQLException: The aggregate function SUM(NETTO) can only be used in select-list, HAVING clause, and ORDER BY clause of SELEC...
I there a way to rewrite a SQL query, so I can avoid IFNULL or COALESCE, because the HXTT DBF JDBC driver (supports SQL92) throws the following error.: Caused by: java.sql.SQLException: The aggregate function SUM(NETTO) can only be used in select-list, HAVING clause, and ORDER BY clause of SELECT statement. The following query causes the above error.: SELECT ( SELECT IFNULL (SUM (shipManagementInvoice.netto ), 0) AS shipManagementInvoiceNetValue FROM tckopf AS shipManagementInvoice WHERE shipManagementInvoice.referenzid = 1 AND shipManagementInvoice.btyp = 5 ) - ( SELECT IFNULL (SUM (shipManagementCreditNote.netto), 0) AS shipManagementCreditNoteNetValue FROM tckopf AS shipManagementCreditNote WHERE shipManagementCreditNote.referenzid = 1 AND shipManagementCreditNote.btyp = 6 ) AS shipManagementResult If I remove IFNULL or COALESCE, there is no error.
BuZZ-dEE (131 rep)
Feb 13, 2014, 08:34 AM • Last activity: Feb 13, 2014, 01:04 PM
0 votes
1 answers
8250 views
Subtract values from SELECT in SQL
I have the following 2 queries.: 1. `shipManagementInvoiceNetValue`: SELECT IFNULL (SUM (shipManagementInvoice.netto ), 0) AS shipManagementInvoiceNetValue FROM tckopf AS shipManagementInvoice WHERE shipManagementInvoice.referenzid = 1 AND shipManagementInvoice.btyp = 5 2. `shipManagementCreditNoteN...
I have the following 2 queries.: 1. shipManagementInvoiceNetValue: SELECT IFNULL (SUM (shipManagementInvoice.netto ), 0) AS shipManagementInvoiceNetValue FROM tckopf AS shipManagementInvoice WHERE shipManagementInvoice.referenzid = 1 AND shipManagementInvoice.btyp = 5 2. shipManagementCreditNoteNetValue: SELECT IFNULL (SUM (shipManagementCreditNote.netto), 0) AS shipManagementCreditNoteNetValue FROM tckopf AS shipManagementCreditNote WHERE shipManagementCreditNote.referenzid = 1 AND shipManagementCreditNote.btyp = 6 but I need the result shipManagementInvoiceNetValue - shipManagementCreditNoteNetValue. I'm using a HXTT JDBC DBF driver that supports more than SQL92 . How can I realize that?
BuZZ-dEE (131 rep)
Feb 11, 2014, 06:42 PM • Last activity: Feb 12, 2014, 07:59 AM
2 votes
2 answers
6941 views
FoxPro DBF Index Corruption
We are running a pretty popular application in Russia and other CIS countries through a pretty old accounting system called BEST. It's all built on FoxPro (not Visual Foxpro) DBF/CDX tables. It's open but it doesn't have API for interacting with other software. So we have to use direct access to the...
We are running a pretty popular application in Russia and other CIS countries through a pretty old accounting system called BEST. It's all built on FoxPro (not Visual Foxpro) DBF/CDX tables. It's open but it doesn't have API for interacting with other software. So we have to use direct access to the tables and data. We use Sybase Advantage Database Server (ADS Internet Connector) to connect our online store to BEST. During developing, testing and running it for the first three months everything was fine. But almost half year ago we started to get index corruption errors. We tried almost everything - replaced network cables and NICs, RAID controller with HDDs, memory, reinstalled windows server. We rebuilt the tables and indexes, looked into the logs - but everything is useless. Once in two days we get index corruption error, so we have to stop the server, reindex tables and start it again and the whole company is waiting for 10 minutes. We have problems with only 2 tables - orders and their contents. All other 300 tables that are used are never harmed. One more problem that is making the case harder is that the problem is not immediate. When the index file is broken - it's not seen. Users continue to work, until one of them starts a new session BEST or a client makes an order. So it's impossible to catch the moment when it happenes. Right now we are blaming ADS. Does anyone know about such problems and their solutions in ADS. I've surfed all the internet looking for answers, but found none. Thanks, if you know something.
pablomedok (23 rep)
Dec 1, 2011, 12:01 PM • Last activity: Jun 16, 2012, 11:37 PM
Showing page 1 of 10 total questions