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

Tablespace fragmentation

$
0
0
Hello,

I was wondering, is there any way to check the level of tablespace fragmentation? If bigger tables are compressed in the tablespace, some tablespace extents become free. They can easily be reused by other tables as they grow, but if they don't - tablespace stays highly fragmented. This may increase the backup time drastically.. So I want to know if I need to look at tablespace fragmentation reduction at all.
db2 9.7.0.8 on Linux.

Regards,

Tomas

Watch Prisoners Online

Watch Instructions Not Included Online

JOINING Columns within the Same Table

$
0
0
Hey folks,

What sort of script would convert a pre-existing table into the second below?

I only want to merge the columns with Primary_IDs 1111 & 3333 to have the same Secondary_ID values, without duplicating any similar Secondary_ID values between the 2 which I've marked in red below.

Code:

TABLE A
==========
Primary_ID | Secondary_ID
1111 | 1
1111 | 2

1111 | 3
1111 | 4
3333 | 1
3333 | 2

3333 | 10
3333 | 20
3333 | 100
3333 | 200
5555 | 12
5555 | 34
7777 | 56
7777 | 78


Code:

NEW TABLE A
==========
Primary_ID | Secondary_ID
1111 | 1
1111 | 2
1111 | 3
1111 | 4
1111 | 10
1111 | 20
1111 | 100
1111 | 200
3333 | 1
3333 | 2
3333 | 3
3333 | 4
3333 | 10
3333 | 20
3333 | 100
3333 | 200
5555 | 12
5555 | 34
7777 | 56
7777 | 78

Monitoring DB2 Upgrade Progress

$
0
0
Hello all,

I'm currently in the process of upgrading my DB2 installation from V10.1 to V10.5 on AIX 7.1. I have finished the initial install of V10.5, and I'm now working on upgrading my existing DB2 V10.1 instances to use the new version. I ran "db2ckupgrade <DBNAME>" to ensure that the database was prepared for upgrade, and it said everything was good. So I kicked off the instance upgrade by running "nohup ./db2iupgrade -u <fenced_ID> <inst_ID> &". I started this over 2 hours ago, and I haven't seen any indication that it has finished, or is even making any progress - I still see the "db2iupgrade" processes active, but the log files stored in /tmp haven't been updated since I started the upgrade.

Is there any way that I can check to ensure that the DB2 instance upgrade is making progress? Like I said, the log files haven't been updated for awhile, so they are not much use. The last message in the db2iupgrade_local.log.8126558 file is:

## Entering: is_firsthost
## Exiting: is_firsthost
## Entering: chk_databases


And the last massage in the output file was:

Task #3 start
Description: Configuring DB2 instances
Estimated time 300 second(s)


It's definitely been a lot longer than 300 seconds since this upgrade started. How can I check if the upgrade is still working?

Drop down tables

$
0
0
Hello,
I'm having some trouble with dropdown tables...

I want to make a POSTGRES db that can be used with openoffice base for a more user friendly interface, because the people that will be inserting data by hand have low pc qualification.

My problem is,
Table 1 (brand)
brand_id (PK and auto-increment int)
brand_designation (brand name UNIQUE varchar(250))
brand_descrption (text)
Table 2

Table 2 (shoes)
shoe_id (PK and auto-increment int)
brand_designation
shoe_size (int)
shoe_designation (text)


Since the db is to be used by random people i dont want them to add manually the brand name... So i created a table with all brands, but i want them to be able to add the brand name instead of the brand id to make it easier.

I found 2 ways to do it: make the brand.brand_designation PK and delete the brand.brand_id or just make it a UNIQUE autoincrement,
or using a trigger that verifys the name before insertion/update.

But, what i really wanted is a away to keep the brand_id as PK and not use a trigger. I want a realtionship between tables and make it possible for the user to insert brand_designation instead of brand_id.

At the end, that would be a dropdowntable in OObase.

If there is no way to do what i'm asking wich one of the 2 that i found is the best? I dont feel that good making brand_designation a PK, and i'm affraid that with trigger option that wont turn out on a dropdown when i go on OObase bc there is no realtionship.
Thankyou

Help need using sub report values in main report

$
0
0
Hi, I am new to crystal, and need some help on how to use a value from a sub report in the main report. I have seen the post on using shared variables and am able to pull the values over to the main report in a section under the sub report with the correct values using the shared variables. But I need to use 2 of these values to do a percentage calculation in the main report. When I create a new formula field in the main report to use these shared values from the sub reports that I pulled over I get a divide by zero error. Can anyone help?

Thanks

Knowledge Base using Access2007 and Sharepoint 2007

$
0
0
How do I create (tables, etc) a Knowledge Base in the Access that ultimately can be published onto SharePoint 2007. I like this to be searchable. Please suggest on tables design, publishing onto SharePoint, and searching aspect, etc.

Saving combo box selections - please help!

$
0
0
Hi everyone,

Is there a way to save the selections in a multi-select combobox so that when I close and then re-open the form, the comobox would still have the same values selected as when I closed the form.

Any help would be appreciated! I am new to access, so code would be very helpful as well!

Thanks,

Improving the performance of a procedure using FOR loop

$
0
0
Dear Experts,

I have created a procedure, which is consuming a lot of hours, i want to imrove the performance by removing 'FETCH' and including 'FOR' Loop.

But im struck with implementing mulitple cursor inside a single FOR loop statement.

Please advise,

here is the query:

CREATE OR REPLACE procedure SYSTEM.Fn_Matching_Entity_Tmp_01
as
cursor c1 is
SELECT * FROM Tbl_Entity_Tmp01 ;--WHERE TRIM(REC_TYPE) ='DE';
-- TYPE dept_tab_type IS TABLE OF c1%ROWTYPE;
cursor c2 is
SELECT * FROM Tbl_Entity_Tmp01 ;--WHERE TRIM(REC_TYPE) ='DE';

C_ENTITYSET_1 c1%rowtype ;
C_ENTITYSET_2 c2%rowtype ;

l_per number;

v_start number;
v_finish number;
v_int number;
VnbrTmp number;
VMatchingPer number;

begin
begin

delete from Tbl_Matching_Tmp01 where Trim(recordtype) ='Entity';
commit;

end;


open c1;

loop

fetch c1 into C_ENTITYSET_1;
exit when c1%notfound;

VnbrTmp :=0;
VMatchingPer :=0;

open c2;

loop

fetch c2 into C_ENTITYSET_2;
exit when c2%notfound;

VnbrTmp :=0;
VMatchingPer :=0;

VMatchingPer := utl_match.edit_distance_similarity( upper(C_ENTITYSET_1.ENTITY_NAME_ARABIC_TMP) ,upper(C_ENTITYSET_2.ENTITY_NAME_ARABIC_TMP));

/* if VMatchingPer >=30

then */

SELECT count(*) into VnbrTmp from Tbl_Matching_Tmp01 where
(C_ENTITYSET_1.ENTITY_ID <> 'XXXXXX' OR C_ENTITYSET_2.ENTITY_ID <> 'XXXXXX')
AND
((C_ENTITYSET_1.ENTITY_ID = Code1 AND C_ENTITYSET_2.ENTITY_ID = Code2
AND
VMatchingPer =MatchingPer)
OR
(C_ENTITYSET_1.ENTITY_ID = Code2 AND C_ENTITYSET_2.ENTITY_ID = Code1
AND
VMatchingPer =MatchingPer) );
/* end if;*/

if VnbrTmp =0
then
insert into Tbl_Matching_Tmp01 values ('Entity',C_ENTITYSET_1.ENTITY_ID,
C_ENTITYSET_1.ENTITY_NAME_ARABIC,C_ENTITYSET_2.ENT ITY_ID,
C_ENTITYSET_2.ENTITY_NAME_ARABIC, 'Fn_Matching_Entity_Tmp_01',
VMatchingPer,
1);

end if;

commit;
end loop;
close c2;

end loop;


close c1;






end;
/

Inventory Management

$
0
0
Hello
I want to develop a access bases database for inventory management having the following features but i dont know how to do

A form to add / del to record
Inventory report for specific period
Suppliers Report

Anyone please help step by step or a sample to help
I am very thankful yo u

Filtering from touch buttons

$
0
0
I'm using ms access 2013
i have a project where i need to create a touch screen jukebox.
my problem is that i have a textbox and a list box.
the list box has all my track and i'm filtering from the textbox.
when i use my keyboard the filter works fine from the textbox.
but when using the touch screen buttons even though letters appear on my textbox, the filter does not work.

any idea how to make my textbox filter work from the on screen touch buttons?
thanks

Sybase ASA 7.0 userid and password

$
0
0
I have an old Oder Entry system that uses a Sybase ASA 7.0 database. The Order Entry System (from the 90's) is still working but the company that produced it is not.
I've been given the task of recovering the company sales data compiled over the last 15 years but I'm stopped at every turn by Sybase DB wanting a user id and password.
I've tried the default userid and password but that doesn't work.
Any advice on how to proceed? I have no interest in the schema... only the data in the tables.
Thanks

Oracle Client version in SQL Server

$
0
0
We have Oracle Client installed in lot of our SQL Servers for Linked Servers.
I can go to each SQL Server and check the Oracle Client version by running SQLPLUS or check under Providers for Linked Servers if OraOleDB.Oracle exists.
There are more than 200 SQL Servers so the process is very tedious if done manually for each server.

Iis there some query like @@version etc to find the Oracle Client Version ? Then I can put in a vbscript and run it across a list of SQL Servers.

thanks in advance !!

Deployment security

$
0
0
Hi, I've recently switched from Access to FileMaker and so far enjoying the ease of setting new databases up.

One quick question on security post-deployment. My DB solution will be hosted in office (back-end) and our salespersons will carry the Go version on site. I use the built-in FileMaker account to log users in.

Is there any way that I can prevent unauthorised access to the DB for salespersons who have left our employment? I understand that I can simply disable their user account, but trust me that our salespersons tend to "share" their accounts and passwords. Don't ask why, it just happens and they all think it's all right :(

Open a file in the attachment field through script

$
0
0
Dear Fellow BD users, I would like to open a file in the attachment field through script. My ultimate aim to open the pdf file in the attachment field to open with my required pdf page for example page 3 instead of page 1. Native field 'left click and right click" is not helping me since I have to pass additional parameters to the open command.

I tried and it is possible only if the file in the attachment field is saved in the local folder of our system(extract file, open file/URL commands). If it is a big file like 250 MB size it is not practically possible everytime you open the file, this attachment field file is first stored in our local system folder and open from there. Hence the aim is to open the attachment field file from there itself through script with additional parameters.
Any idea? Thank you in advance.

Attached Files
File Type: zip open attchment field file by script.zip (93.3 KB)

Should be a simple sub query - I thought

$
0
0
Hi all,

I am new to this forum so sorry if I've posted this question in the wrong place. I have tried searching but I don't quite know how to ask the question in the search engine.

So here goes.

The company I work for has recently deployed an off the shelf third part datamart for it's call centre. It is only new and we've had some issues so I don't want to go playing with it's structure just yet and are trying to use the default structure to achieve what I'm trying to.

I have 4 tables: 1 fact, 2 dim and 1 linking table.

The fact contains the detail about the call, call_ID, Resource that managed the call, measurements about the call.

Dim 1 contains the details about the resource: name, staff_id
Dim 2 contains details about the groups that the resource belongs to: group name, group type

The link table contains 2 foreign keys to link the resource to the group type (since the resource can belong to many groups). It also contains audit keys on when the resource key was given a different group key indicating the resource moved from one group to another.

The challenge I have is I need use dim2 and the link table to return the most recent group changed based on a filter and then use the resource key from the same link table to link display the resource details. The fact table is then linked to the resource table by the resource key to show the details of the call.

Usually when I'm querying this data I am selecting the groups i am interested in but for this one query I need to see how many calls have been transferred to another group (for which I don't know the value). And because the resource can belong to multiple groups (for historical reporting) I am getting multiple results.

What I am doing is limiting all of the group values from dim2 to only those with the string 'Team' in them at a specified location (substr(group_name,4,4)='Team').

I then link those this subquery back to the link table and do another subquery to return the audit key value for when changes occurred.

I then want to return the maximum value for the audit key and I think this is where I'm coming unstuck. Because I have the group key each value is unique so I'm getting multiple maximum values.

I'm just not sure how to limit the dim2 values and then calculate the maximum audit key value.

here is a sample of the SQL I'm using.

SELECT AG_Grp_2.AGENT_NAME AS XFER_INIITATED_AG,
AG_Grp_2.GROUP_NAME AS XFER_INIITATED_GRP,
TRUNC(fact1.START_TS_TIME) AS XFER_INITIATED_DATE,
fact1.RECEIVED_FROM_IXN_RESOURCE_ID AS XFER_INITIATED_KEY,
TO_CHAR(fact1.START_TS_TIME, 'dd/mm/yy hh24:mi:ss') AS XFER_INITATED_DATE_TIME,
AG_Grp_2.EMPLOYEE_ID AS XFER_INITIATED_ID
FROM
(dim2.GROUP_NAME,
dim1.AGENT_NAME,
res.Res_key,
dim1.EMPLOYEE_ID
FROM
(link1.RESOURCE_KEY AS Res_key,
MAX(link1.START_TS) AS MAX_TS_START
FROM link1
INNER JOIN link1
ON link1.GROUP_KEY = dim2.GROUP_KEY
WHERE SUBSTR(dim2.GROUP_NAME, 4, 4) = 'Team'
GROUP BY link1.RESOURCE_KEY
) res
INNER JOIN link1
ON res.MAX_TS_START = link1.START_TS
AND res.Res_key = link1.RESOURCE_KEY
INNER JOIN dim1
ON dim1.RESOURCE_KEY = link1.RESOURCE_KEY
INNER JOIN dim2
ON link1 = dim2.GROUP_KEY
) AG_Grp_2
INNER JOIN fact1
ON fact1.RESOURCE_KEY = AG_Grp_2.Res_key

Value of last record still appear on combobox afterupdate

$
0
0
Hi, all!

I'm using MS Access 2010.

I have a form for adding part.
1. Same prefix Part ID for same category of parts (eg. C for all types of chair).
2. Able to add multiple of Part ID in one short (eg. if my first ID is C0005, if input quantity 5, C0005 to C0009 will be saved into database).

But I have a problem, after the new record has been saved, the value of last record still appear on a combobox (Part Type). I want the Part Type combobox to be cleared in the new record. But I can't spot the problem.

Thanks a lot if anyone can tell me what went wrong with my vba or setting in the properties of the combobox (Part Type). I have attached the file for your reference.

Regards,
Jim

Attached Files
File Type: zip Add Part.zip (145.0 KB)

how to convert a decimal(8,4) on SQL to a numeric(8,4) on DB2?

$
0
0
I have a value (in SQL SERVER) that I am trying to insert into DB2.

Declare @Measure float

@Measure = SELECT -48.51

INSERT OPENQUERY(AS400DB2, 'SELECT Measure FROM SomeTable')
VALUES (Measure)

I tried char(8) and it looks like this on sql server -4851 but in DB2 the field is Numeric(8,4) is -48.51 but if I send at 9999.9999 - the char(8) in SQL Server fails with Arithmetic overflow error converting numeric to data type varchar.


select cast(9999.9999 as char(8))


Please help. As I need answer asap. Thanks.

problem in creating table - error 150

$
0
0
Dears,

Actually I was used this sql script to create the table scheme on mysql 5.0.24, and it was just working fine, the problem is when i tried same script on mysql 5.5.16 i get below error message:

Quote:

general error message from server: "can't create table 'amdb.am_wta_methodtree' (errno: 150)"
Here it is sql script:

Code:

create table AM_WTA_MethodInstance(
"ID" BIGINT NOT NULL,
"TRANSACTIONID" BIGINT NOT NULL,
"INVOCATIONTIME" BIGINT NOT NULL,
"METHODIDENTIFIERID" BIGINT NOT NULL,
"THREADID" VARCHAR(255) NOT NULL,
"INCLUSIVETIME" BIGINT NOT NULL DEFAULT 0,
"EXCLUSIVETIME" BIGINT NOT NULL DEFAULT 0,
"STATUS" INTEGER(1) NOT NULL DEFAULT 0,
"EXCEPTIONMESSAGE" TEXT,
PRIMARY KEY ("ID"),
FOREIGN KEY(METHODIDENTIFIERID) REFERENCES AM_WTA_MethodIdentifier(ID),
FOREIGN KEY(TRANSACTIONID) REFERENCES AM_WTA_Transaction(TRANSACTIONID) ON DELETE CASCADE)

create table AM_WTA_MethodTree(
"PARENTID" BIGINT NOT NULL,
"CHILDID" BIGINT NOT NULL,
"INVOCATIONTIME" BIGINT NOT NULL,
PRIMARY KEY ("PARENTID","CHILDID"),
FOREIGN KEY(PARENTID,CHILDID) REFERENCES AM_WTA_MethodInstance(ID,ID) ON DELETE CASCADE)

Viewing all 13329 articles
Browse latest View live