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

Report generates ID instead of field name

$
0
0
I have 3 dynamic combo box. a combo box > filters b combo box and b filters c combo box. showing the field names whereas connected on field ID's. But my problem is when I am running reports (reports in form of charts) on the data saved in the backend through these combo boxes on the form. When I run report it shows ID's of combo box B instead of field name. Please help:eek:

Data Studio - Is the execution time correct?

$
0
0
Hi all, new here.
I'm timing some queries to build up a benchmark of sorts using Data Studio 4.1 on Windows. What I have found though is that after starting; the query might run for 5 minutes but the execution time will display as 245ms, as an example. There can be a massive discrepancy between me with a stop watch measuring and the Data Studio "execution time".
I guess the question is; what does execution time measure?
Does it include server round-trips? In my example it spent 4min+ doing that?
By the way I only observe this occasionally, not all the time.
Anyone else having this issue?

Is it possible to alter capture program in Q rep

$
0
0
Is it possible to alter capture program in Q replication, such that changes in two or more tables can be replicated to one target table?
We need to update a target table from more than one source tables i.e. if target table has 10 columns, 5 needs to be populated from table T1, 3 from T2 and 2 from T3.
Due to some licence issue, I'm unable to run Q rep and hence can't check the above requirement myself.

Finding Users Permissions on tables

$
0
0
I'm trying to put together a list of all my user in my production database, and see what access they have on certain tables. I found the following script, but I'm not sure how to make out the permissions column it's returning. Can someone explain to me what the how to read column 'relacl', does the '/' represent each user?

Or does anyone know a different way I can pull all users and see what tables they have permission to, and also see what those permissions are?

Code:

SELECT relname as  "Relation"
      ,relacl  as  "Access permissions"

FROM pg_class

WHERE  relkind IN ('r')

AND relname !~ '^pg_'

ORDER BY relname;

Need some help with populating a Form

$
0
0
I have a small problem with a Form I have created.

I created a db to keep track of specific deatils when visting with clients. These details are mostly questions and other details that should be asked everything we meet and were not set up to be tracked in my primary management system.

I am running Access 2010

Tabels:
AllAgentInfo
- This table is a linked table to a SQL db table that I created that holds all the client info such as Agent Code, Agent Name, Address etc.

Visit_Data
- This is a blank table that has fields for all the info I want to track. I have created fields for the fields that I want to auto populate from the AllAgentInfo table mentioned above.

Both tables mentioned above are linked by AllAgentInfo!AgentCode and Visit_Data!Agent_Code. The other tables in the db contain sales statistice about each client.

Forms:
I have created a form based on the Visit_Data table. I have added all the fields I want to use to auto populate the Visit_Data table from the AllAgentInfo table. I have also added free form, and other combo box fields that would populate the Visit_Data table that would be competed during each visit.


What I have been trying to with little success is "on load" of the form I would like to be able to cycle and view all of the auto populated data from the established table, at the same time the fields that were not populated but will be during each visit would stay blank while cycling through.

I have been using the following code to populate the form with the data from the AllAgentInfo table.
Code:

Private Sub Form_Load()
Me!Agent_Code = DLookup("AgentCode", "dbo_KSMALLAgentInfo")
Me!Agency_Name = DLookup("ProducerName", "dbo_KSMALLAgentInfo")
Me!Branch_Name = DLookup("BranchName", "dbo_KSMALLAgentInfo")
Me!Address1 = DLookup("Address1", "dbo_KSMALLAgentInfo")
Me!Address2 = DLookup("Address2", "dbo_KSMALLAgentInfo")
Me!City = DLookup("City", "dbo_KSMALLAgentInfo")
Me!State = DLookup("State", "dbo_KSMALLAgentInfo")
Me!Zip = DLookup("Zip", "dbo_KSMALLAgentInfo")
Me!County = DLookup("County", "dbo_KSMALLAgentInfo")
Me!Contact_Title = DLookup("ContactTitle", "dbo_KSMALLAgentInfo")
Me!Contact_Name = DLookup("ContactName", "dbo_KSMALLAgentInfo")
Me!Phone = DLookup("Phone", "dbo_KSMALLAgentInfo")
Me!Fax = DLookup("Fax", "dbo_KSMALLAgentInfo")
Me!Email = DLookup("Email", "dbo_KSMALLAgentInfo")
End Sub

Now this works as far as showing the first record in the AllAgentInfo table. However I cannot cycle through any other records that are in the table and I cannot paste an AgentCode into the respective field to search for another agent. I also get error messages requiring me to complete the other form fields that are not auto populated.

I have also tried to use the following code which has worked in other forms but this method populates nothing in my form.
Code:

Private Sub Agent_Code_AfterUpdate()
Me!Agency_Name = DLookup("ProducerName", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!Branch_Name = DLookup("BranchName", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!Address1 = DLookup("Address1", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!Address2 = DLookup("Address2", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!City = DLookup("City", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!State = DLookup("State", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!Zip = DLookup("Zip", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!County = DLookup("County", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!Contact_Title = DLookup("ContactTitle", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!Contact_Name = DLookup("ContactName", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!Phone = DLookup("Phone", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!Fax = DLookup("Fax", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
Me!Email = DLookup("Email", "dbo_KSMALLAgentInfo", "AgentCode = Forms!Visit_Data_Form!Agent_Code")
End Sub


If someone could help me I would really appreciate it. If I forgot to mention a detail then please ask me and I will respond with whatever you need.


Thank you in advance

SQL0727N An error occurred during implicit system action type "5".

$
0
0
I'm receiving a very strange -551 SQLCODE when trying to execute a DB2 stored procedure. It doesn't matter if I try to execute it from Toad or from my java application. I get the same error:

COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/LINUXX8664] SQL0727N An error occurred during implicit system action type "5". Information returned for the error includes SQLCODE "-551", SQLSTATE "42501" and message tokens "E005206|SELECT|CCDB.CLAIM_COMMON_1". SQLSTATE=56098

The funny thing is, I can execute SELECT statements against the table "CCDB.CLAIM_COMMON_1" if I run it by itself in Toad. But once I put the statement into an SP and call the SP I get the error. Does anyone have any insight as to why I can execute a SELECT statement on it's own but not when it's inside an SP?

This one has me stumped (as well as our DBA).

db2 double upgrade / aix snapshot issues

$
0
0
Hi

We are trying to upgrade in a new server from 9.1 to 10.1 ( we checked with IBM earlier and moved from 9.1 to 9.7 and then we installed 10.1)

Its 1.5 terabyte db , it takes around 10 hrs to backup and restore , so to cut short the down time we asked to try aix snapshot . It will take the entire file system where we just need to change the db2nodes.cfg of the new server. we are fine with all the 9.7 installations and everything look good. but when we install 10.1 and tried to upgrade it gave us issues

Version of DB2CKUPGRADE being run: VERSION "10.1"

Database: "STRLPRD"

[IBM][CLI Driver][DB2/AIX64] SQL1326N The file or directory "/dbdata/db2home/strlprd/strlprd" cannot be accessed.


DBT5537I The db2ckupgrade utility has completed processing for database "STRLPRD".

DBT5529N The db2ckupgrade utility did not complete successfully. The database cannot be upgraded.

we sorted out by giving chmod 777 -R /dbdata/db2home/strlprd/strlprd
it resolved the issue .but still we want to know whether it will have any impact down the line. please advise

Statistical Table Via Data Table

$
0
0
First Time Post Here.
I have 2 tables in a Mysql database. Everytime a new part is sold an insert occurs in to the PartsSoldTable. What I want to do is everytime an insert occurs into the PartsSoldTable. I want to somehow update the AveragePriceTable showing the updated average price. I would also like it to be dynamic in that say for instance a new part "Part F" is inserted into the PartsSoldTable, The AveragePriceTable would add a new entry showing this and list its average.
I am unsure if something like this is even possible and if so how should I go about it. On a side note I would actually be willing to pay someone to figure this out for me.

Attached Images
File Type: png DatabaseQuestion.PNG (30.2 KB)

How to obtain previous year data in an array

$
0
0
I am wanting to create a report that will look at the last 3 months of sales. The data is held in an array.
I want the end user to be able to select the 1st month and the year for that starting month.

My problem is how do I deal with a month selection of either January or February as the previous month(s) will be in a prior year.
I currently have the two formulas below which work well as long as January or February are not selected.

Month1 =
((local stringvar array x;
x:=split({oe_hist_prod.units-shipped}, ";");
tonumber(x[{?Month 1}]);) -
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-nrstkd}, ";");
tonumber(x[{?Month 1}]);) -
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-rstkd}, ";");
tonumber(x[{?Month 1}]);))

Month2 =
((local stringvar array x;
x:=split({oe_hist_prod.units-shipped}, ";");
tonumber(x[{?Month 1}-1]);) -
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-nrstkd}, ";");
tonumber(x[{?Month 1}-1]);) -
(local stringvar array x;
x:=split({oe_hist_prod.units-returned-rstkd}, ";");
tonumber(x[{?Month 1}-1]);))

Month3 is similar @ x[{?Month 1}-2]

I am unsure how to incorporate the month & year selection into either the formulas directly or indirectly through other formulas.

Thanks for any help that can be offered.

Missing Field(s) In Design View

$
0
0
This make-table query produces the desired result:

Code:

Select FieldA,
      FieldB,
      Max(SomeFloat) As SomeFloat
Into NewTable
From OldTable
Group by FieldA, FieldB

This gives the correct data --> Select * from NewTable

In SSMS, the columns for NewTable shown are:

FieldA Number
FieldB Character
SomeFloat Null <-- Datatype "Null"

And NewTable in Design View doesn't even show the SomeFloat field.

The work-around is to explicitly type column 3 as --> Cast(Max(SomeFloat) As Float) As SomeFloat

Then things look OK.

I don't understand why the table holds data (the Select * from Newtable works)
Yet the column that holds the Domain data doesn't even show up in design view.

Any ideas anyone?

Thanks,
Wayne

SQL Query - help required - possibly transpose??

$
0
0
For the attached Table structure, I am not able to build the required output, not sure if I need to apply transpose, of which I don't have a strong knowledge.
Please have a look at the jpg attachment. Mentioned towards the end is the SQL script for table creation and data insertion.

Output should be in the format as shown in the jpg attachment and ID_MAX_VAL of output result should be the max of ID for each manufacturer-country combination in main source table. I need to fetch the max id for each manufacturer-country combination and display/use them to send out a report.

Note: This is a test data and table structure to simulate the actual business requirement.

A view similar to the table I have mentioned is the only thing that we have access to and that works as our sole source. Have to work with that only. Need your help in forming the query to obtain the desired output.

Script:
Code:

CREATE TABLE TB_TEST_01
(
  ID NUMBER(6) NOT NULL
, PARAM_NM VARCHAR2(200) NOT NULL
, PARAM_VAL VARCHAR2(200)
);
/

INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (10, 'MANUFACTURER', 'NISSAN');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (10, 'COUNTRY', 'USA');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (30, 'MANUFACTURER', 'NISSAN');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (30, 'COUNTRY', 'UK');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (20, 'MANUFACTURER', 'NISSAN');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (20, 'COUNTRY', 'UK');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (50, 'MANUFACTURER', 'HONDA');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (50, 'COUNTRY', 'USA');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (60, 'MANUFACTURER', 'HONDA');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (60, 'COUNTRY', 'USA');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (80, 'MANUFACTURER', 'HONDA');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (80, 'COUNTRY', 'USA');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (70, 'MANUFACTURER', 'HONDA');
INSERT INTO TB_TEST_01 (ID, PARAM_NM, PARAM_VAL) VALUES (70, 'COUNTRY', 'UK')
;
/
COMMIT;


Attached Images
File Type: jpg SQL_Input_Output.JPG (74.8 KB)

xml load_file mysql

$
0
0
Hi I have an urgent problem. I have tried to transfer data from my XML into my database, I have created tables.

My xml files located here rickikristensen.dk/kml

I created tables with the same names, but my rows continue to be filled with NULL when I load the files.

Anyone can help?

Report generates only one record in MS Access 2013

$
0
0
Hi everyone. Pls I need help on how to generate my reports. A report that has a query as its record source is showing only one record instead of the 68 that appear in the query when it is run. Thanks.

Create a record in a table when running a query

$
0
0
Hi,

I am trying to create a query that will append a record to a table when someone has ran an update query on a table.

This is so I can monitor who has ran that specific query and report based on this information.

It would be useful as well to have a number of rows affected column as part of the record.

Thanks

Combo box returning wrong results in Access 2010

$
0
0
I have an unbound combo box that I set up in a form using the combo box wizard in Access 2010. I selected the option that says, “Find a record on my form based on the value I selected in my combo box.” The problem is that the combo box will not always display the correct record. It seems to only display the first record of a group of similarly named records in a table. I have found similar posts, but no solution.

Example:
Code:

    Last Name  First Name  SSN
    Smith      Alex        123-45-6789
    Smith      Jane        234-56-7891
    Smith      Mary        345-67-8910

If I select Smith Jane, the record for Smith Alex will display. I know that this has something to do with the bound column property, but I am unsure what to do to fix the issue.

What I have tried:
I tried setting the primary key as the first field, but then I could only search by the primary key, which is unrealistic for this database. Users will be searching based on last name. How do I make the combo box select whichever record I select from the drop down list?

V9.3.3 pg_basebackup not completing

$
0
0
A new wrinkle has developed on my production server. I was trying to rebuild a standby server after another developer here was testing some scripting and broke that standby. Not a big deal as this is not a production system. However, part of the procedure for building a new standby involves taking a pg_basebackup from the master server and putting it on the standby as an initialization point. My pg_basebackup is not completing now, and stopped with:

pg_stop_backup cleanup done, waiting for required WAL segments to be archived

I've not seen this issue before, but since the database isn't production, there's not a lot of activity on it. Now, timeout has caused several dozen WAL files to be in pg_xlog and they all seem to be in the archive area. I can't seem to find anything telling me what's causing this or how to satisfy the utility. Anyone have any ideas?
--
Jay

Postgresql server is not asking for a password

$
0
0
I am running a local Postgres Sql Server and I have a database called my_database.
I have also create a new user called 'tester' on that database with password 'test_password' but when I give the command line..



psql -U tester -d my_database

..Postgresql server is not asking for a password.

Any ideas?
Thank you.

Adding column to table replicated through SQL Replication

$
0
0
We're using IBM SQL Replication 9.1 to replicate a table from MS SQL to DB2, but we need to make a DDL change by adding a column to the table. I can't find any documentation on IBM's site showing how to do this, so can someone point me to a starting point or possibly send some notes on how to do this? I guess worse case I can delete the subscription and CCD table then recreate it, but I'd like to know if there's some automatic way for it to pick-up the DDL change or possibly see what IBM suggests to make such a chance.

Thanks.

Scheduled Maintenance Tracking: DB Design

$
0
0
Hey, everyone. So I am making an equipment database in MS Access. Part of that database is to track the maintenance of each piece of equipment.

So let's each piece of equipment would have certain maintenance weekly, bi-weekly, monthly, etc. While not every piece of equipment would have something to be done for each of these items, they will all likely have something for at least one of these timeframes.

I am stuck on how I should handle this design wise. The main goal is to make sure that the end users know what maintenance is coming up (what maintenance is due for the next week or two, etc.). I am thinking of having a "dashboard" on the main page that shows what maintenance is coming up and what is over due, but I am not sure how to translate this into a table.

Has anyone run into something like this before? I'm open to suggestions. Many Thanks.

How do I create a query to get dates that do not match?

$
0
0
I would like to run a query to see dates that do not match.

I have a table with master dates and a table that is updated daily. Both have common field names “Wo_Del_Date”.

I would like to run a query to see any dates that does not match.

The wo_del_date from both tables should always be an exact match and I need to see the dates that are not.

How can I perform this function?

Thank you.
Viewing all 13329 articles
Browse latest View live