Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all 13329 articles
Browse latest View live

Calculating Totals

$
0
0
Hello,
This data is imported from another system. Need to add certain types of pay, so in this case add their Normal pay and subtract any pay Docks. Later, I would need to add up the other columns as benefits. Challenging part is pay types are scattered among different columns. Not sure if I should attempt to build new tables, or just try to add the fields as they are? Any advice is appreciated!
example.jpg
Attached Images

Programmatically Link Access Tables To SQL Server

$
0
0
I have an access database that has all local tables. I am in need of pro grammatically linking these tables into SQL Server. I have seen multiple instances of how to go from SQL Server to Access - but none on how to go Access to SQL Server. Can someone give me some guiding direction?

DB2 Stored procedure - Add hours as input to a timestamp

$
0
0
Hi!
I want to create a stored procedure that has a IN_NROFHOURS as input, indicating number of hours. Then I want to create a cursor that fetches all rows with the following condition:

select * from listtable where startdatetime + in_nrofhours > current timestamp

My questions are:

What is the best datatype for IN_NROFHOURS;
Given the datatype you suggest, how should the "where" condition be stated?

Thanks for your help, I appreciate that.

creating partition tables consumes more space.

$
0
0
Hi All,

I am running db2look output sql file which I took from prod in test server.Smaller tables are getting created faster in no time, however partition tables taking too much time and consuming too much disk space.Lets say one single partition table is taking 20 mins to create and consumes disk space between 300 to 500 MB.As this is a test server, disk space is limited.500 MB just for table ddl is unbearable.Is there any way for creating tables without consuming this much disk space?Table creation DDL doesn't have any parameters related to extend allocation.Please find the attached
sample DDL.

Is there anything similar to deffered segment creation like in Oracle in DB2?

DB2 version is DB2 v9.7.0.3 Fix Pack "3a".

Regards,
Aswin
Attached Files

New Skyvia with support for E-commerce, Marketing, E-support and Google Apps released

$
0
0
Devart announced the release of Skyvia, universal cloud service for no coding data integration, cloud-to-cloud backup and online data management via SQL.

Prague, Czech Republic, 19 October 2016 - Devart, a recognized vendor of database management software, data connectivity solutions and developer tools, announced the release of Skyvia 4.3, all-in-one web service for cloud data integration, backup and management. The new Skyvia version offers beta support for Google Apps and widely used marketing, e-commerce, and e-support apps including Marketo, HubSpot, Freshdesk, Zendesk and Shopify.

For Skyvia users, now there is an ability to use popular integrations, such as Zendesk and Salesforce, Shopify and Mailchimp, Marketo and Salesforce, Hubspot and Salesforce, and many others. The updated Skyvia also provides easy integration of cloud applications and relational databases with Google Apps, including Google Contacts, Google Calendar, and Google Task.

Skyvia Data Integration contains a wide range of data related scenarios which can be created from the convenient and unified user interface. Skyvia users can migrate data from one source to another, set up bi-directional data synchronization with flexible scheduling, import or export data to different sources, including CSV, as well as replicate cloud data to relational databases. At this stage all Data Integration functionality is completely free.

Even though cloud data sources seem to be reliable and secure, there is still always a chance that data will destroy due to employee mistake, incorrectly working third party application or major disaster where the data center is destroyed. Skyvia Backup can protect all of customer’s cloud data, offering automatic daily or anytime manual backup with search, view, export of backed up data and few-clicks data restore.

In Skyvia 4.3 users can easily access their Shopify, Zendesk, Freshdesk, HubSpot, Marketo and Google Apps data online, build queries visually, simply by drag and dropping the necessary fields or by using the full power of SQL language, and visualize it in a form of grid or charts to get quick data insights. Only web browser and Internet connections are required.

For more information about Skyvia, please visit: https://skyvia.com/

About Devart


Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers and cloud apps, data integration and backup solutions. The company also implements Web and Mobile development projects.

Learn more about Devart at: https://www.devart.com

Update Global Temporary Table (Sample code provided)

$
0
0
I have been working in T-SQL for many years and need to transition to DB2. I'm finding the syntax is different in many areas so I'm trying to adjust and become better acclimated with this. I can not get my code to Update a temporary table. I am supplying a sample code just for sake of an example. Can someone please advise where I am going wrong with this? I am only using 2 tables just to make it simple as to what I am trying to accomplish as my real code has many other ways I need to update data.

I keep getting an error at the FROM part.

Code:

DECLARE GLOBAL TEMPORARY TABLE SESSION.TEST_TABLE
(
TMP_TIME        TIMESTAMP(6)        ,
TMP_ORDER_ID        INTEGER,
TMP_PRIORITY_CODE        CHARACTER(8
)
ON COMMIT PRESERVE ROWS not logged with replace;

insert into SESSION.TEST_TABLE
select distinct
ORDER_TIME,
ORDER_ID,
NULL
from
TABLE 1
where
ORDER_TIME between '8/1/2016' and '8/3/2016'

UPDATE SESSION.TEST_TABLE
SET
TMP_PRIORITY_CODE = priority_code
FROM
TABLE 2
WHERE
TMP_ORDER_ID = PRIORITY_ORDER_ID;

select * from SESSION.TEST_TABLE;

drop table SESSION.TEST_TABLE;

Update group of rows in table

$
0
0
Hi,

My first post here...

I need help with one UPDATE statement.

I have one table similar to this:

ID T_ID | TT
---|-----------------
1 | 1dfgr3 | 9
2 | 1dfgr3 | 9
3 | 1dfgr3 | 9
4 | 1dfgr3 | 3
5 | 456sf6 | 9
6 | 456sf6 | 9
7 | 456sf6 | 5
8 | 456sf6 | 9


Now, I have altered table and added new column called TTT and final state of table should be like this:

ID T_ID | TT | TTT
---|---------------------------
1 | 1dfgr3 | 9 | 3
2 | 1dfgr3 | 9 | 3
3 | 1dfgr3 | 9 | 3
4 | 1dfgr3 | 3 | 3
---------------------------------
5 | 456sf6 | 9 | 5
6 | 456sf6 | 9 | 5
7 | 456sf6 | 5 | 5
8 | 456sf6 | 9 | 5

So, UPDATE should be like 'UPDATE TABLE1 SET TTT=(select TT from TABLE1 where TT<>9) but for group of values displayed in T_ID column.

So, question is, how can I update table so it will look for same values in T_ID column, and then search for value in TT which is <> 9 and then make and update to TTT column with single value?

Regards,

Apache won't start after clone from Sol 10 to Sol 11

$
0
0
Hi All,

We are in the process of migrating our EBS R12.1.3 system onto new hardware. The current o/s is Solaris 10. The new server has Solaris 11. As recommended by Oracle, we used the standard cloning method to achieve this process and have nearly completed our first test migration.

We have however hit an issue whereby when starting the web tier services, Apache fails to start with a 204 error code. It refers to another log file which has the error: 'Can't stat executable /u01/DBA/inst/apps/DBA_svt-ebsapp08/ora/10.1.3/Apache/Apache/bin/.apachectl' (and yes it really does say 'stat'. I think that is an Oracle typo).

This is the first time I have ever encountered the .apachectl hidden file and having looked around the internet, I can find rare instances of this file being mentioned. All I know is that it is a binary file which I think calls apachectl.sh.

I would really appreciate any assistance anyone can give. To be honest, even if anyone can advise what this file does or give any info to help direct us, it would be much appreciated as Oracle themselves appear to know less than I at this stage.

I'll attach the logs just in case anyone is interested. Thanks ;-)

DB Design for SCADA

$
0
0
Hi All,
I am working on designing a DB for a SCADA system and trying to understand the best approach to tables for the analogue sensors.
Potentially I could have 1000 (maybe even more) sensors across this network all needing to write back to the DB.

I plan to have a table detailing grouping of inputs into logical nodes and another grouping logical nodes into groups.
At this point I am unsure how to store the actual samples, however I am thinking of a new table for each input. This will allow time stamped data to be stored separately for each input.
This would mean that ever time a new input is added to the network, a new table would need to be created.
It would also allow for easy archiving of data when inputs are removed and prevent any corruption of a single sensors table affecting all of the data.

The problem with this is I am not sure how to then set up the relationships with the other tables unless I enter the input ID into every entry which would be redundant data.
Any help would be greatly appreciated

Thanks

Diff of two datetimestamps

$
0
0
Hi,

I have written following code to find diff in minute of two datetimestamp, but while compiling getting below error msg :

PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got DATE.

The code is as below :

declare
l_v_new_var varchar2(200) := '21-OCT-2016 22:59:00';
l_v_new_var_1 varchar2(200) := '21-OCT-2016 20:00:00';

l_n_number number;
begin
select to_date(l_v_new_var,'DD MON YYYY HH24:MI:SS') - to_date(l_v_new_var_1,'DD MON YYYY HH24:MI:SS') * 24 * 60 into l_n_number from dual;
dbms_output.put_line(' l_n_number '||l_n_number);
end;
/



Thanks with Regards,
JD

Declare and Execute Variable in Ad-Hoc Query (code is provided)

$
0
0
I've primarily work in Rapid SQL (Sybase) for over 10 years now but need to use DB2 at times and finding there are differences with declaring variables among other things. Here is an example of what I'm trying to accomplish. It works fine with Declaring my Temp table and manually adding the dates but can't get the Date variables to work of which I can do this easily in Sybase Rapid SQL (different from this of course). Could someone help me understand what I'm missing and how I can get my date variable to execute in the select query?

I'm using 10.5 DB2.

Code:

Begin Atomic   
Declare v_BeginDate Timestamp;
Declare v_EndDate Timestamp;

Set
v_BeginDate = '8/1/2016',
v_EndDate = '8/3/2016';
End

DECLARE GLOBAL TEMPORARY TABLE SESSION.TEST_TABLE
(
TMP_TIME        TIMESTAMP(6)        ,
TMP_ORDER_ID        INTEGER,
TMP_PRIORITY_CODE        CHARACTER(8
)
ON COMMIT PRESERVE ROWS not logged with replace;

insert into SESSION.TEST_TABLE
select distinct
ORDER_TIME,
ORDER_ID,
NULL
from
TABLE 1
where
ORDER_TIME between v_BeginDate and v_EndDate

UPDATE session.test_table T
set T.tmp_priority_code = (select S.priority_code from table2 S where S.priority_order_id = T.tmp_order_id);

select * from SESSION.TEST_TABLE;

drop table SESSION.TEST_TABLE;

initdb running while installing PostgreSQL 9.5 on Windows

$
0
0
Hello,

I had a question about PostgreSQL 9.5 installation on WIndows. I am trying to upgrade my server from PostgreSQL 9.3 to 9.5 and I noticed a difference while installing PG9.5 . I use this script to install PG 9.5 :

Code:

postgresql-9.5.4-1.exe --serviceaccount postgres --servicepassword DataBase1 --servicename PostgreSQL95 --prefix C:\Database\postgresql --datadir C:\Database\datadir\postgresql --mode unattended
When I execute this script, it runs the initdb, creates the DataDir (i.e. C:\Database\datadir\postgresql) , also creates the PostgreSQL95 service and starts it which was not the case with PostgreSQL 9.3 . I used the same script for 9.3 and it did not 1. Run the initdb and created the data directory 2. Register the DB service and start it during the time of installation.

I wanted to know if there is a way to just install PG9.5 without running initdb and getting the DB service registered?

I do not want to use the --extract-only option.

Thanks

Automatic Runstats

$
0
0
DB2 LUW 9.7.6
Windows Server 2008

How does DB2 determine which table should run statistics first when Automatic Runstats is activated? Customized filter has no "Order by".

Regionalization -- Round II

$
0
0
At a food bank in Gatineau Quebec, I am putting together a program to track volunteer hours. The hours are in a doubles field, with hours and portions of hours (e.g. 3.5 hours). I take this data, and report it as a crosstab (by month and year), with columns being the month. For each year, I want to total the months.

When totallying, I explicidly turn each field total into a numeric value using "val()". If one does't do this, Access treats each field in the report as a text field, and concatenates the fields in the total (ie. 12 + 2 becomes 122). All good so far; using " = val(t1]) + val([t2]) +....... " works fine with values and fractional values on an Windows American or English formatted system. On a French system, however, val() appears to strip out all fractional values. so that 38.5 becomes 38. The French system replaces a period with a comma (e.g. 38.1 becomes 38,1). This behaviour causes totals to be understated (and wrong)

When I return to the foodbank, I will try to use the CDBL function instead of val() on their French-formatted machines to see if this helps.CDBL works in place of val() on English-formatted systems. Anyone have any experience with this problem?

Regards

John S

how to uninstall fixpack

$
0
0
First I used fixpack was v9.7fb4 in db2 directory then I have updated to v9.7fb6.
Now I am uninstalling by useing
./installFixpack -b db2_directory -f level

But not revert the fixpack.
Please answer share me.

Review Assistant 3.5 Moved from SQLite to SQL Server

$
0
0
Devart has released an updated Review Assistant 3.5, a code review tool for creating review requests and responding to them without leaving Visual Studio. Review Assistant server now uses Microsoft's SQL Server for the back-end database.

Devart, a recognized vendor of professional database tools for developers and DBAs, has announced a release of a new version of Review Assistant, a code review plug-in for Visual Studio.

Review Assistant 3.5 includes the following new features and improvements:

The previous versions of Review Assistant have been successfully using fast and reliable SQLite as a database engine. It requires no configuration and maintenance and works fine for small teams. Since our customers' teams increased greatly revealing the performance issue of SQLite server caused by concurrent work of a large number of users, it was decided to move Review Assistant to SQL Server. An improvement of the tool's performance is expected by using SQL Server as a database engine for Review Assistant now.

Other improvements
*Any comment in a review can be marked as fixed.
*In a simple review workflow, reviewers can close a review after code is accepted.
*The "search-as-you-type" suggestion appears when adding users to a project.
*On the Code Review Board, the projects in the drop-down list are now sorted alphabetically.
*Working with a long list of comments in a review became faster.

Review Assistant is a code review plug-in for Visual Studio. The tool allows creating review requests and responding to them without leaving Visual Studio. Review Assistant supports TFS, Subversion, Git, Mercurial, and Perforce.

Learn more about Review Assistant at https://www.devart.com/review-assistant/

Prices and Availability

A free version of Review Assistant is restricted up to 3 users and 1 project. Review Assistant for an unlimited number of users is available for a 30-day trial period.

About Devart

Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration and backup solutions. The company also implements Web and Mobile development projects.

Learn more about Devart at https://www.devart.com.

Expression not working in SSRS expressions builder

$
0
0
Can any one tell me why expression builder is not accepting expressions it shows to be valid? If you look at the examples it gives on the left side of the window you see "="Tomorrow is " & DateAdd("d",1,Today())" but if you cut and paste "DateAdd("d",1,Today())" example to the expression window it gives error on the parenthesis after Today(). In my case I am trying to default a date selection to 30 days back from today. I thought it was my expression but seeing it gets the same error on the example they show I'm not sure this isn't a bug.

Untitled.jpg
Attached Images

Pass Multiple Values from a Variable (sample code provided)

$
0
0
I am adjusting from Rapid SQL on a Sybase Server to DB2. This standard approach works well when passing multiple values assigned to a variable with a ", " separating each value in that variable:

In this case I am looking for the "product_code" that has one of the values in that variable. In this example I want to pull product_code A or B or C.
Code:

declare
@variable varchar(100)

select @variable = 'a,b,c'

select distinct * from table 1
where
(@variable = "*ALL"  or charindex(ltrim(rtrim(product_code))+",", ltrim(rtrim(@variable))+",") > 0)


I understand now how to use the Begin Atomic method for variable such as this but struggling with the equivalent approach from T-SQL to DB2 to read each variable value separated by a comma if I were to add one to this piece of code. Would a REPLACE function work somehow or an index value?:

Code:

drop table SESSION.DAILY_READ_REP;
DECLARE GLOBAL TEMPORARY TABLE SESSION.TEST_TABLE
(
    TMP_TIME            TIMESTAMP(6),
    TMP_ORDER_ID        INTEGER,
    TMP_PRIORITY_CODE  CHARACTER(8)
)
on commit preserve rows not logged with replace;
begin atomic
 declare v_BeginDate timestamp ;
 declare v_EndDate timestamp ;

 set v_BeginDate = timestamp('2016-08-01');
 set v_EndDate = timestamp('2016-08-01');
    insert into SESSION.TEST_TABLE
        select distinct
              ORDER_TIME,
              ORDER_ID,
              NULL
        from table1
        where
        ORDER_TIME between v_BeginDate and v_EndDate;
end;
select distinct * from SESSION.TEST_TABLE;

Query: Filtering 2 columns from same table

$
0
0
I have been trying to figure this out but I just can't seem to get it done. I'm posting here in hopes that someone may have a solution. Here is the scenario:
I have 1 Table with a few columns, the two columns i want to filter are date(yy-mm-dd) and time (in decimal format). I want to get the row with the latest
date and time. Here is what I am working with right now:
Code:

$conn = new PDO("mysql:host=$servername;dbname=xx_xxxxxxxx", $username, $password);
$connII = new PDO("mysql:host=$servername;dbname=xx_xxxxxxxx", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$connII->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$stmtII = $connII->prepare("SELECT * FROM allbugs");
$stmtII->execute();

foreach ($stmtII->fetchall() as $rowII){
        $stmt = $conn->prepare("
        SELECT tt.*
        FROM bugs tt
        INNER JOIN
                (SELECT symbol, value, MAX(date) AS MaxDate, time
                FROM bugs
                GROUP BY symbol) groupedtt
        ON tt.symbol = '".$rowII['symbol']."'
        AND tt.date = groupedtt.MaxDate
        GROUP BY tt.time DESC LIMIT 1
");
$stmt->execute();

Now the output should look like the following:
[SYMBOL] --- [VALUE] --- [DATE] --- [TIME],
With the row being the latest entry for the current date
Any help would be appreciated. Thanks

dbForge Studio for Oracle Comes with Redesigned Object Editors and Database Search

$
0
0
Devart team has released a new version of Oracle IDE, dbForge Studio for Oracle v.3.9 with completely redesigned Visual Object Editors and Database Search as well as with improved Data Viewer and Editor window.

Devart, a recognized vendor of professional database management software for developers and DBAs, has released a new version of dbForge Studio for Oracle v3.9.

dbForge Studio for Oracle v3.9 now includes the following new features and improvements:
*The Database Search tool has been completely redesigned for optimal search of both – objects and data
*Visual Object Editors have been totally redesigned
*Virtual Columns are now supported in Visual Object Editors and Schema Compare
*Greatly improved suggestion performance
*Improved XML View and new JSON View for Data Editor and Viewer Window
*Generate Script As now supports selection of multiple objects
*Styled icons are used by default.

In addition, now dbForge Studio for Oracle 3.9 comes with a new icon design.

dbForge Studio for Oracle is a powerful integrated development environment (IDE) for Oracle, which helps developers to increase PL/SQL coding speed, provides versatile data editing tools for managing data. This tool for Oracle allows synchronizing data between different Oracle servers and automating schema change management process during development. It also contains lots of features wrapped into a smooth GUI consistent with Microsoft Visual Studio.

dbForge Studio for Oracle v3.9 is freely available for a 30-day evaluation period. The product license prices start from $149.45.

For more information about the improved dbForge Studio for Oracle v3.9, please visit https://www.devart.com/dbforge/oracle/studio/.

About Devart

Devart is one of the leading developers of database tools and administration software, ALM solutions, data providers for various database servers, data integration and backup solutions. The company also implements Web and Mobile development projects.

For additional information about Devart, visit http://www.devart.com/.
Viewing all 13329 articles
Browse latest View live