Sample Header Ad - 728x90

Database Administrators

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

Latest Questions

0 votes
1 answers
1048 views
SQL query using MAX with multiple table joins
I have a working SQL script to show results that join multiple tables. However, I want to limit the results of the join to show only one record per a given "Chart Number" value in one of the tables. Here is the original query: SELECT MWPAT."Chart Number", MWPAT."First Name", MWCAS."Case Number", MWC...
I have a working SQL script to show results that join multiple tables. However, I want to limit the results of the join to show only one record per a given "Chart Number" value in one of the tables. Here is the original query: SELECT MWPAT."Chart Number", MWPAT."First Name", MWCAS."Case Number", MWCAS."Marital Status" FROM MWPAT MWPAT INNER JOIN MWCAS MWCAS ON (MWCAS."Chart Number" = MWPAT."Chart Number") INNER JOIN MWINS MWINS ON (MWINS.Code = MWCAS."Insurance Carrier #1") INNER JOIN MWTRN MWTRN ON (MWTRN."Chart Number" = MWPAT."Chart Number") Where MWTRN."Date From"> '01/01/2000' GROUP BY MWPAT."Chart Number", MWPAT."First Name", MWCAS."Case Number", MWCAS."Marital Status" ORDER BY MWPAT."Chart Number" And here is the sample output for this query: | Chart Number | First Name | Case Number | Marital Status | | :----------- | :--------- | :---------- | :------------- | | 000001 | John | 2 | Single | | 000001 | John | 8 | Single | | 000001 | John | 15 | | | 000005 | Sarah | 35 | Single | | 000005 | Sarah | 42 | Married | | 000009 | Fred | 7 | Single | | 000036 | Mary | 89 | Divorced | I need to limit this output to only show one line per "Chart Number" column of the MWCAS table, based on the highest "Case Number" value that appears for the given Chart Number. For example- the output would show this instead: | Chart Number | First Name | Case Number | Marital Status | | :----------- | :--------- | :---------- | :------------- | | 000001 | John | 15 | | | 000005 | Sarah | 42 | Married | | 000009 | Fred | 7 | Single | | 000036 | Mary | 89 | Divorced | Note that each Chart Number only shows one line now, which is based on the information of the MWCAS table, and choosing the highest Case Number value for the output. I have tried different uses of MAX but I cannot find a syntax that works. I'm querying Advantage Database, so this could be limiting. Appreciate any suggestions.
jengashare (9 rep)
Mar 23, 2023, 05:56 PM • Last activity: Apr 24, 2025, 07:05 PM
0 votes
1 answers
569 views
SAP BO Freehand SQL date formatting (Oracle db)
My original query worked perfectly via SQL Developer: `select * from [table] where DT_CURRENT_DT = '15-OCT-18'` However when ran via freehand SQL in SAP BO I got no results. After running the query with no conditions I noticed that BO re-formats the date to `10/15/18`
My original query worked perfectly via SQL Developer: select * from [table] where DT_CURRENT_DT = '15-OCT-18' However when ran via freehand SQL in SAP BO I got no results. After running the query with no conditions I noticed that BO re-formats the date to 10/15/18
marcin2x4 (145 rep)
Nov 16, 2018, 08:10 AM • Last activity: Jan 27, 2025, 03:08 AM
0 votes
1 answers
132 views
SQL Anywhere 17 Silent Installation
My requirement is, Administration Tools (32-bit) and SQL Anywhere 32-bit (Server as well as client enabled) I have passed the silent installation command in my Dockerfile setup.exe /s ....... So on Regkey etc and SA32=1 AT32=1 It gets installed successfully, but server 32-bit is not enabled because...
My requirement is, Administration Tools (32-bit) and SQL Anywhere 32-bit (Server as well as client enabled) I have passed the silent installation command in my Dockerfile setup.exe /s ....... So on Regkey etc and SA32=1 AT32=1 It gets installed successfully, but server 32-bit is not enabled because when I verified dbeng dbserv all these files are missing in Bin32 folder There are no additional commands to enable the SQL Anywhere 32-bit (server) feature, and client is by default enabled. What do I do? Please share your knowledge!
fathima farwa (1 rep)
Dec 21, 2024, 10:04 PM • Last activity: Dec 24, 2024, 03:13 AM
0 votes
0 answers
15 views
Business Objects 4.3 dependent variables
I'm using Business Objects 4.3 to query my HR system and have 4 objects on the report from one table with multiple records. I want the latest record and the corresponding values for each object. Example: |Person ID|Check Date|Renewal Date|Reference Number| |---------|----------|------------|--------...
I'm using Business Objects 4.3 to query my HR system and have 4 objects on the report from one table with multiple records. I want the latest record and the corresponding values for each object. Example: |Person ID|Check Date|Renewal Date|Reference Number| |---------|----------|------------|----------------| |4566|1/1/23|31/12/23|123| |4566|1/1/24|31/12/24|456| All columns currently show MULTIVALUE against the person ID (key field) as the check data is from a sub query. I have used Max on the Check Date to get the latest entry but I don't want to put max on the other columns in case of errors in the data. EG if I put max on both date columns I would get the bold entries instead of a renewal date of 31/12/23 |Person ID|Check Date|Renewal Date|Reference Number| |---------|----------|------------|----------------| |4566|1/1/23|**31/12/24**|123| |4566|**1/1/24**|31/12/23|456| So how can I make the variable for Renewal Date or Reference Number dependent on the entry returned for Check Date, ie. return the whole corresponding record? I tried where check date = max(check date) but it didn't like that. Thanks
lulu2608 (1 rep)
Nov 6, 2024, 05:07 PM • Last activity: Nov 6, 2024, 05:13 PM
0 votes
1 answers
1216 views
SQL Anywhere 12 - exporting data to Excel
Do I need to install MS Office Excel on machine where is SQL Anywhere 12 server for below code to work? Or SA 12 or Windows have MS Excel Driver builtin? SELECT * FROM SalesOrders; OUTPUT USING 'Driver=Microsoft Excel Driver (*.xls); DBQ=c:\\test\\sales.xls; READONLY=0' INTO "newSalesData";
Do I need to install MS Office Excel on machine where is SQL Anywhere 12 server for below code to work? Or SA 12 or Windows have MS Excel Driver builtin? SELECT * FROM SalesOrders; OUTPUT USING 'Driver=Microsoft Excel Driver (*.xls); DBQ=c:\\test\\sales.xls; READONLY=0' INTO "newSalesData";
BlueMark (247 rep)
Mar 2, 2016, 08:46 PM • Last activity: Jun 19, 2022, 06:53 PM
0 votes
1 answers
116 views
Oracle client 12c , if i can't find uninstallation file, can i install 19c client on same server?
I have a server that has oracle 12 client installed but now have an application that references the same server that needs oracle client 19c installed in order to work with the service. I cannot seem to find the uninstall file on the server and wondering if i can install 19c in addition as only one...
I have a server that has oracle 12 client installed but now have an application that references the same server that needs oracle client 19c installed in order to work with the service. I cannot seem to find the uninstall file on the server and wondering if i can install 19c in addition as only one workgroup has a 19c database and needs the 19c client
OluT (1 rep)
Mar 24, 2022, 10:39 AM • Last activity: Mar 24, 2022, 12:03 PM
0 votes
1 answers
530 views
How many databases does a sybase instance have?
I'm a newbie to sybase and could not find the clear answers on Sybase tutorials/docs - How many databases can one Sybase instance have? Oracle has one instance which corresponds to only one database, is it the same with Sybase ? - What is a master database, is it a db that holds metadata? Does each...
I'm a newbie to sybase and could not find the clear answers on Sybase tutorials/docs - How many databases can one Sybase instance have? Oracle has one instance which corresponds to only one database, is it the same with Sybase ? - What is a master database, is it a db that holds metadata? Does each instance have one master database ? - What is a user database ? Is it similar to a tenant db in sap hana ?
user5844653 (1 rep)
May 13, 2020, 02:23 AM • Last activity: Feb 22, 2022, 07:05 AM
0 votes
1 answers
1062 views
How do you extract discount data from SAP?
I'm **not** a SAP developer. We already have a big SSIS package that pulls data from the SQL Server instance that our SAP installation uses and I need to add discount data to it. I've usually had pretty good luck looking through this package and the SAP UI and then using Google & [SAP Data Sheets](h...
I'm **not** a SAP developer. We already have a big SSIS package that pulls data from the SQL Server instance that our SAP installation uses and I need to add discount data to it. I've usually had pretty good luck looking through this package and the SAP UI and then using Google & [SAP Data Sheets](https://www.sapdatasheet.org/abap/) to figure out how the tables are laid out, but this time I'm totally lost. In the SAP UI, the data I'm searching for is listed under the order document conditions. The Googling I have done makes it pretty clear that I'm supposed to use VBAK.KNUMV and JOIN to KONV.KNUMV. Here's the problem: our server doesn't have KONV. I found a [forum post](https://archive.sap.com/discussions/thread/586011) that says that I can JOIN to KONP.KNUMH instead, but for the sample document I'm working on, there's no corresponding record in KONH. I can't find an explanation for why KONV doesn't exist, and I don't know why JOINing VBAK.KNUMV to KONH.KNUMH doesn't work. If anyone could guide me down the right path, I would appreciate it. I don't know SAP, so I am not really clear on what a cluster table is. They kind of sound like views, which is fine, but no object with the name KONV exists in SQL Server. Saying that KONV is a combination of KONH and KONP is also fine, but that doesn't appear to actually be true. I need to know where this data physically lives in SQL Sever and that's what I can't figure out.
nateirvin (756 rep)
Feb 9, 2017, 08:19 PM • Last activity: Aug 18, 2021, 05:01 PM
0 votes
1 answers
5593 views
What is the max network latency between synchronous-commit AlwaysOn Availability Groups
Is there a maximum supported network latency (ms) between two synchronous AlwaysOn replica? I need to give this information to network administrators for configuring the link between the two nodes of the cluster. I know that syncronization between replicas is influenced by disk speed and other thing...
Is there a maximum supported network latency (ms) between two synchronous AlwaysOn replica? I need to give this information to network administrators for configuring the link between the two nodes of the cluster. I know that syncronization between replicas is influenced by disk speed and other things: The picture in this [article](https://techcommunity.microsoft.com/t5/sql-server-support/troubleshooting-data-movement-latency-between-synchronous-commit/ba-p/319141#) explain the process involved. The AlwaysOn instance will host the sap database (1 TB of data) and I estimate that the workload will be considerable with large transactions.
Gio (107 rep)
May 20, 2020, 10:43 AM • Last activity: Nov 10, 2020, 08:35 AM
0 votes
0 answers
555 views
SQL Server database in Recovery mode, how to troubleshoot?
I have a SAP instance running with a 'SQL Server' database that just recently got into recovery mode without a clear reason (no backup or restore was executed). We noticed that the storage for logs (max 50gb) was `99%` used. After cleaning unused data and turning the db to online, everything was bac...
I have a SAP instance running with a 'SQL Server' database that just recently got into recovery mode without a clear reason (no backup or restore was executed). We noticed that the storage for logs (max 50gb) was 99% used. After cleaning unused data and turning the db to online, everything was back to normal. But I need to identify the root cause. What can you suggest, please, as a troubleshoot analysis approach? More details: `MSSQL release 12.00.6329.01 DB Client Library msodbcsql13 Database Releases MSSQL 9.00.2047 or higher` It's connected to SAP system via Database Shared Library: `DBSL Version 753.02 DBSL Patch Level 510 SQL Server 2014 120`
comebackhere (1 rep)
Feb 3, 2020, 07:26 AM • Last activity: Feb 3, 2020, 09:07 AM
1 votes
1 answers
2588 views
Turn off listener logging in oracle 12c release 2
I am trying to turn off listener logging in oracle 12c R2 (SAP on oracle), but I am getting a TNS-12508 error. I have verified that the listener.ora is owned by the oracle user and I am performing the task as same oracle user, but I am still getting an error. ### File Permissions -rw-r--r-- 1 oracle...
I am trying to turn off listener logging in oracle 12c R2 (SAP on oracle), but I am getting a TNS-12508 error. I have verified that the listener.ora is owned by the oracle user and I am performing the task as same oracle user, but I am still getting an error. ### File Permissions -rw-r--r-- 1 oracle oinstall 1151 Oct 23 13:48 listener.ora ### Listener Error LSNRCTL> set current_listener LISTENER_AAA. Current Listener is LISTENER_AAA LSNRCTL> set LOG_STATUS OFF Connecting to (ADDRESS=(PROTOCOL=IPC)(KEY=AAA.WORLD)) TNS-12508: TNS:listener could not resolve the COMMAND given LSNRCTL> set log_status off Connecting to (ADDRESS=(PROTOCOL=IPC)(KEY=AAA.WORLD)) TNS-12508: TNS:listener could not resolve the COMMAND given Am I missing something here?
pradyu (13 rep)
Nov 20, 2018, 06:41 AM • Last activity: Oct 14, 2019, 07:58 AM
0 votes
1 answers
26 views
Add a years field to a date field?
I have the below fields and would like to add the contract_term field to the date field: Contract_Term: Years Date: YYYY/MM/DD For example: 3(contract_term) + 2019/01/01(date) = 2022/01/01 What would be the best way for me to achieve the above result? Thanks for any help.
I have the below fields and would like to add the contract_term field to the date field: Contract_Term: Years Date: YYYY/MM/DD For example: 3(contract_term) + 2019/01/01(date) = 2022/01/01 What would be the best way for me to achieve the above result? Thanks for any help.
Singh (5 rep)
Sep 25, 2019, 11:18 AM • Last activity: Sep 25, 2019, 11:25 AM
0 votes
0 answers
188 views
Trigger to insert new row into second table causes "Connection is busy with results for another command"
I have created this trigger to insert new row into table `@AL_ORDR_TRACKER` after new row is inserted in table `ORDR`. CREATE TRIGGER dbo.trgAfterInsertORDR ON dbo.ORDR AFTER INSERT AS BEGIN INSERT INTO dbo."@AL_ORDR_TRACKER" (U_DocEntry, U_Updated) SELECT DocEntry as U_DocEntry, GETDATE() U_Updated...
I have created this trigger to insert new row into table @AL_ORDR_TRACKER after new row is inserted in table ORDR. CREATE TRIGGER dbo.trgAfterInsertORDR ON dbo.ORDR AFTER INSERT AS BEGIN INSERT INTO dbo."@AL_ORDR_TRACKER" (U_DocEntry, U_Updated) SELECT DocEntry as U_DocEntry, GETDATE() U_Updated FROM inserted END The trigger gets registered but when inserting new rows into ORDR I get the error message: Connection is busy with results fro another commands What might be going wrong here?
W.M. (167 rep)
Aug 29, 2019, 06:34 PM
2 votes
0 answers
326 views
Extracting Data from SAP to SQL Server
I am using SSIS packages to extract data from SAP database tables into SQL Server tables. I am using OLEDB source/destination connections to achieve this. The problem now is that a table in SAP has 5 Million records and its taking around 2 hours to extract this data into my SQL Server table. I have...
I am using SSIS packages to extract data from SAP database tables into SQL Server tables. I am using OLEDB source/destination connections to achieve this. The problem now is that a table in SAP has 5 Million records and its taking around 2 hours to extract this data into my SQL Server table. I have used the trunc-dump method (truncating the table in sql server and dumping data into it from SAP table) and also tried using Multiple Hash key to bring in the updated/new records. The problem with Hash key is that it still has to scan the entire table to look for changed/new records and hence takes almost the same time as the trunc-dump method. I am looking for a new way or changing the existing way to reduce the time taken to complete this extraction.
Rahul (131 rep)
May 15, 2019, 05:03 PM
0 votes
1 answers
675 views
What is a online atomic mode backup
I am reading the SAP guide administrator of BO, and I am a little confused about some term they use regardless how to perform online or hot backups. Using the same words > For hot backups, use the database vendor's backup tools in online atomic mode It is the first time ever that I heard about onlin...
I am reading the SAP guide administrator of BO, and I am a little confused about some term they use regardless how to perform online or hot backups. Using the same words > For hot backups, use the database vendor's backup tools in online atomic mode It is the first time ever that I heard about online atomic backups. And what is the difference between these kind of backups and normal backups?? While the guide is talking about making offline backups they do not use the term **online atomic mode** so I think administrator should perform a normal backup (Normal for me) Could anyone make some light please?? Thanks in advance
federico (17 rep)
Sep 18, 2017, 10:06 PM • Last activity: Sep 18, 2017, 10:51 PM
0 votes
1 answers
31 views
How to display all entries that have had a box ticked since a particlar date
Good afternoon, I would be very grateful is someone would be able to offer some assistance to a query I have regarding some SQL I'm needing to implement. In our database we have a range of customers that have specific properties/category tick boxes associated with them. We're wanting to display a li...
Good afternoon, I would be very grateful is someone would be able to offer some assistance to a query I have regarding some SQL I'm needing to implement. In our database we have a range of customers that have specific properties/category tick boxes associated with them. We're wanting to display a list of all customers that have a certain tick box selected/ticked since a set date. This date is 05-07-17. Would this be possible? Kind of lost as how to display this. Se screenshot below.. properties list associated with customer account Kind regards, Chris
Chris (1 rep)
Sep 1, 2017, 11:12 AM • Last activity: Sep 1, 2017, 12:19 PM
1 votes
1 answers
674 views
ip address record in sybase ASE auditing database?
everone. I installed the *sybsecurity* database for auditing in *sybase ase 15.5*. The installation is OK. I configured the audit commands, for example, for auditing the sa user, and other users of the database. I see that the column `extrainfo` for the table `sysaudits_01` shows additional informat...
everone. I installed the *sybsecurity* database for auditing in *sybase ase 15.5*. The installation is OK. I configured the audit commands, for example, for auditing the sa user, and other users of the database. I see that the column extrainfo for the table sysaudits_01 shows additional information. I need to add the IP address of of users who perform certain commands: for example, GRANT, INSERT, 'UPDATE, DELETE, SELECT, and CREATE`. I see that rows in login attempts include the IP address in the extrainfo column. I checked the code of the file C:\Sybase\ASE-15_0\scripts\instsecu but I can't find how to add the IP address to extrainfo to my table. How can I capture the IP address for certain actions, and record it in extrainfo?
Luis Antonio Mantilla (13 rep)
Aug 17, 2017, 10:09 PM • Last activity: Aug 17, 2017, 10:58 PM
0 votes
1 answers
1578 views
Change left outer join on SAP Universe Design Tools
I need to create a report with SAP Universe Design Tool but when I try to construct a LEFT JOIN between tables, SAP automatically create a LEFT OUTER JOIN when it executes the query in Web Rich Client. Is it possible to force SAP to build a query just with a LEFT JOIN so it does not create blank lin...
I need to create a report with SAP Universe Design Tool but when I try to construct a LEFT JOIN between tables, SAP automatically create a LEFT OUTER JOIN when it executes the query in Web Rich Client. Is it possible to force SAP to build a query just with a LEFT JOIN so it does not create blank lines in the report?
Thomaz Lima (3 rep)
Jun 14, 2017, 01:18 PM • Last activity: Jun 14, 2017, 01:41 PM
1 votes
1 answers
289 views
Performance difference between single large Application instance vs multiple small Application Instance in Netweaver
Can anyone please comment on the performance impact of having a single large application server instance vs multiple small application server instance in SAP Netweaver on a single machine.
Can anyone please comment on the performance impact of having a single large application server instance vs multiple small application server instance in SAP Netweaver on a single machine.
a curious engineer (159 rep)
Nov 11, 2016, 05:21 PM • Last activity: Nov 14, 2016, 11:00 AM
1 votes
0 answers
73 views
MaxDB - Strange behaviour when selecting from a CLOB-Row
I am using "sqlcli" for Linux to write the output of the following query into a file: > select clob_field from table (...) in SAPGui (original user input) the contents are displayed as: First line Second line Third line in Database Manager the contents are displayed as: First lineSecond lineThird li...
I am using "sqlcli" for Linux to write the output of the following query into a file: > select clob_field from table (...) in SAPGui (original user input) the contents are displayed as: First line Second line Third line in Database Manager the contents are displayed as: First lineSecond lineThird line But in my output-file it is displayed as: First line\rirst line \nrst Line Second line \rst line Second line \nt line Second line Third line My desired output-file should look like: First line\nSecond line\nThird line I am seriously out of ideas of what's happening here or how to fix output. MaxDB also does not seem able to perfom any kind of "CAST"-function. Replacing "\n" and "\r" doesn't work either, since it does not replace special characters. Any ideas?
Alex (11 rep)
Aug 15, 2015, 08:37 AM
Showing page 1 of 20 total questions