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

Remove trailing zeros after decimal point in DB2 in char column

$
0
0
have the following values in label table in DB2 (version : 9.5.8)
select field4 from lablel with ur
1.5000
0.006
9.0001
104.2500
17.0000
3.5000

Is this possible to eliminate the trailing zero's after the decimal point by a update query in DB2, if all the values are zeros's after the decimal point i need to keep that as .0

Excepted output:
1.5
0.006
9.0001
104.25
17.0
3.5

Retrieving data from a recordset

$
0
0
Hi. I'm very new to the Access / VBA world and am currently working on a database for work. I'm having difficulty in recalling data typed as checkboxes after it's been saved. I've tried a couple of different things but it doesn't seem to work. I can save the data with no problem, but I need the user to be able to recall it in case of an error. Can anyone provide an example of the coding for something like this? Please let me know if you need further information. Thanks.

Column-oriented table: generated column not supported?

$
0
0
Hi!

I'm just about to exploit DB2 10.5 on a Suse Enterprise Linux VM provided by IBM.
I setup workload=analytics and created a column-oriented db.
I wanted to use the SQL dump of my existing (row-oriented) SQL application for a comparison.

However, the insert statements fail as follows:

Create statements with generated columns which I heavily use in the application like this one:

Code:

CREATE TABLE tab1 (
                id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( START WITH 1 INCREMENT BY 1 MINVALUE 1 MAXVALUE 250000),
                attrib CHAR(200))
        organize by column;

fail with

"The CREATE TABLE statement failed because some functionality was specified in the table definition that is not supported with the table type. Unsupported functionality: "Generated column".. SQLCODE=-1666, SQLSTATE=42613, DRIVER=3.67.28v"


Does anyone know a workaround to modify the insert statements so that I can use a column-oriented db (without modifiy all my java application code on top)?

I thought of using sequences but as I got it, I cannot refer to them by my existing java code using "return_generated_keys" like in
"PreparedStatement t = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)".

It seems to me that there a kind of "unofficial" restrictions to column-oriented tables in SQL, is there a list of IBM?

running external files

$
0
0
Hi,

I need to run a bat file that sets up a shell environment and then need to send a command.

If doing this by hand I would double-click that .bat file that opens up the command prompt and sets up the environment. I would then type in a command at the prompt.

Is there any way that I can replicate this from within BD, by clicking a button?

Cheers

Matty

sample helping in oracle apex ?

$
0
0
Hi every one,

Simple Introduction,
I make a simple program before by Oracle APEX is a program very simple for my accounting and registration of financial debt and personal benefits.

And before I rented domain for my APP and linked with my personal server, & Everything was fine .

But then I want to be sharing my APP via the internet with all users by free .. 

I now, " This is my question focus " I want to sharing my app via internet for all public user, without any confusion data between user and another, Where anyone can come to the site and register as a new user and enter into the program Only finds its own data without any data other users.

What are the guide lines or steps in apex to do that?
What the part or chapter name in oracle APEX books, Or what the name of books to read it to can doing this alteration?


Thanks for help me ..

Last Financial Year

$
0
0
Hello

I have the following syntex which gives me the start date of the current FY, which is 01/04/2014

However, I am trying to now get the Start Date of the previous FY and require some assistance on this if possible

SELECT decode(to_char(sysdate, 'Q'),
'1', trunc(add_months(sysdate, -9), 'Q'),
add_months(trunc(sysdate, 'YYYY'), 3))
from dual;

I have tried breaking it apart and testing it, but have not yet been able to get the start pf the last FY

Any help would be greatly appreciated

Hello, hello

$
0
0
I'm not a techie, I work in marketing within an ISV, but always interested in what's current and hot topics in the world of databases, so I hope to pick a bit of info up from everyone here.

Exporting Date field from Ms Access form to Excel shee

$
0
0
I am trying to export date field from MS ACCESS form to Excel Sheet through following VBA code but it prints as a number such as 41795 instead of actual date on access form.

Dim objexcel As Excel.Application
Dim objworkbook As Excel.Workbook
Dim objxlsheet As Worksheet
Set objexcel = CreateObject("Excel.Application")
''Set objworkbook = objexcel.Workbooks.Open("C:\MSEXCEL_TEST" & "\" & "test.xlsx")
Set objworkbook = objexcel.Workbooks.Open(CurrentProject.Path & "\" & "HERCA_TWTTP_FORM.xlsx")
Set objxlsheet = objworkbook.ActiveSheet




objxlsheet.Cells(11, 4) = Me.dateIdentified
objxlsheet.Cells(4, 1) = Me.txtProblem
objxlsheet.Cells(4, 10) = Me.txtOperation
objxlsheet.Cells(11, 13) = Me.txtOperatorName
objxlsheet.Cells(11, 30) = Me.txtInterviewerName
objxlsheet.Cells(13, 13) = Me.dateCompleted
objxlsheet.Cells(12, 13) = Me.txtTeam
objexcel.Visible = True
Set objexcel = Nothing
End Sub


HOW CAN I CHANGE IT TO ACTUAL DATE. :(

Sum after a certain date in another table

$
0
0
I need help with a query. I have a table that has a file# and a date and another table that has a list of the same file# and amounts. i need to sum the amounts on second table if there are after the date of the first table.

For example:
File# Date
a1 12/01/2013
a2 09/05/2013

Table2
File# Date Amt
a1 10/01/2013 25.00
a1 01/01/2014 185.00
a1 02/01/2014 185.00
a2 11/15/2013 214.00
a2 12/15/2013 265.00

ResultQuery
File# Sum
a1 370.00
a2 479.00

Hope that makes sense.

Data Type Conversion on All Date Fields

$
0
0
Hi all,

I'm very new to Access and VBA so I'm sure this is probably a simple fix but I can't seem to figure it out. I have a rather large database with multiple forms that record dates when investigations and assignments are completed. There are multiple dates as the assignment progresses and the managers approve it. The problem I'm having is I can't save anything unless all the dates are filled in. I keep getting a Data Type Conversion Error until the date fields all have something in them. The forms are unbound and I've programmed everything with VBA. Any help would be greatly appreciated. Thanks.

PS. I've checked to make sure data types on the tables and the forms match up.

Access 2007 CDO - Attachments ( Hard one )

$
0
0
Good day everyone,
This is my very first forum post anywhere! :beer:

I am building a database to manage my every day work and projects. I have been trying so hard to be able to send Emails from access using a gmail account. I was successful on sending emails (subject, body, cc, bcc, to ). As I come to the attachment part, I can't figure out any lead on how to do it.

I have my attachments stored in my database as fields and in some cases each attachment field holds more than one attachment. I was proactive on making all these attachments be part of subforms (3 in total) and my plan is to have a way to include these subforms on the main form I am sending emails from. Reason for that is because on that main form, all of my CDO, Email attributes get inputted.

Now the big, big challenge is : How do I get to the point where I can select any attachment(s) so that they get added to my .Addattachment.

The challenge mostly goes into

1-How to have a unique link to every attachment, given that access stores multiple attachments in a single field.

2-I have 3 fields and each one of them can have many attachments. I assume that each attachment will have a checkbox to it, which when checked my code will eventually know that it is to be included in the Email.

If someone is comfortable in helping me out, I can surely be more descriptive and post my code or snapshots of what I am trying to do.

thank you very much.

Parameters Setting

$
0
0
Dear Seniors,

I had created the query with Parameter values, say cut off date and it works fine.

But the problem is I face some problems when the parameter is entered in wrong format. Is it possible to have date picker for selecting the dates in parameter, similarly drop down box for selecting other values.

Also some time my query is taking long time to show the result and export to excel, How to get the result very quickly? It will be done when I put primary key for all my tables?

Thanks and Regards
R. Vadivelan

Generate Query results based on Date

$
0
0
Dear Seniors,

Is it possible to generate the query results based on Cut off date?

i.e. I have a database where the datas are updated on daily basis. Now my boss wants to have the report based on some cut off date. For a simple query I am able to generate the report and its fine.

Whereus I am facing problem when I generate a results with multiple query/Table.

For ex my Table contains the following data

DOC1 - IFR - 02-Feb-14
DOC2 - IFR - 05-Mar-14
DOC3 - IFR - 06-Mar-14
DOC1 - IFA - 03-Mar-14
DOC2 - IFA - 03-Apr-14
DOC3 - IFA - 05-Apr-14

And I created a query for getting the latest status of document based on maxdate

So my query results in
DOC1 - IFA - 03-Mar-14
DOC2 - IFA - 03-Apr-14
DOC3 - IFA - 05-Apr-14

Now I want the same query to return the results as follows based on some date say 30-Mar-14

DOC1 - IFA - 03-Mar-14
DOC2 - IFR - 05-Mar-14
DOC3 - IFR - 06-Mar-14

But I am getting the result as follows
DOC1 - IFA - 03-Mar-14

Could you please help me how to sort out this issue ?

I hope that I had explained my problem in clear, please let me know for further clarifications.

Data migration from Oracle to DB2

$
0
0
Hi All,

Has anyone worked on data migration from an Oracle to DB2 database.

I need to migrate application data from Oracle(11g) to DB2(10.1) on Linux. Source and target DB schema are pre designed.

I am looking for the best possible approach.

I have previously worked on data migration from Oracle to MySQl on windows but have used third party ETL tool.

Any help will be appreciated.

Thanks.

Sybase stored procedure error handling

$
0
0
I am new to sybase. After studying a bit I came to know following is the correct way to handle error/exceptions in sybase stored procedure.

CREATE PROCEDURE dbo.sp_testErrorHandling (@age varchar(20))
AS
BEGIN
DECLARE @myerr int

BEGIN TRANSACTION mytrans

DELETE FROM TestStoredProc where Name='Z'
IF @@error<>0 BEGIN SELECT @myerr=@@error GOTO failed END

DECLARE @result int
EXECUTE @result = 5/0 /* throws an exception */
IF @@error<>0 BEGIN SELECT @myerr=@@error GOTO failed END

COMMIT TRANSACTION mytrans
RETURN 0

failed:
ROLLBACK TRANSACTION mytrans
return @myerr

END
I thought, this stored procedure would return the error code correspondin to exception devision by zero. But actually it is throwing exception.
So for which of the errors/exceptions sybase would return error code without throwing exception and for which of the errors/exceptions sybase would throw an exception directly?
Please help me to undestand the behaviour.

If a stored procedure contains only select statements(one / more than one) what is best way to return error codes when some error occurs?
regards,
Anirban

Technical Specialist – Faster Payments Gateway

$
0
0
Technical Specialist – Faster Payments Gateway

£36125 - £52395 + excellent benefits package

Edinburgh

LBG Grade: EL-EU


Making full use of your knowledge of our platform and your analytical skills, you’ll develop valuable technical solutions. Whether you’re working independently or as part of a team, you will provide efficient, effective software solutions and share your knowledge of best practice to ensure ongoing improvement. This will include involvement in coaching and mentoring. Your varied responsibilities will range from reviewing platform deliverables and documentation, through to requirement assessment and option definition. Along the way, you’ll work with a range of key stakeholders, external partners and our Quality Assurance team, to support the successful achievement of IT strategies. If you have extensive relevant knowledge, skills and experience, you’ll enjoy the scope to play a coordinating role.

Having strong skills in software development lifecycle is essential, and you should be able to demonstrate this through your experience to date.

We are looking for individuals that have experience in 1 or more of the following technologies:

• IBM Mainframe z/OS

• ISPF / TSO

• CICS Transaction Server

• VSAM

• MQ series

• DB2

• Unix

In addition candidates should be familiar with UK domestic payments with an emphasis on the Faster Payments Service.

To be equal to the challenge, you’ll need specialist knowledge, together with insight into products and procedures. As a skilled technical analyst, you’re familiar with various software applications. Highly organised and self-motivated, you have a flair for change management.

In return, we’ll recognise and reward your performance. Our award-winning benefits package includes a flexible option that allows you to choose cash or pick from a wide range of benefits. These include a contributory pension scheme, private medical insurance and retail discount vouchers. You’ll also have our full support, training and opportunities for both personal and professional development.

For more information, please follow this link: http://service.joberate.com/redirect...3-dd-e0-e1b796

Enforcing rules on generalised data model.

$
0
0
Hi everyone. I've looked through the forums for an answer to this question but I can't find much, so I thought I would ask. The data model in the link below is just a made up example, so some things might not strictly make much sense.

http://i61.tinypic.com/hx851c.jpg

I'll refer to the green section as the "generalised model" and to the pink section as the "specific model". They both represent the same concepts at a different level of generalisation.

The following are some bare-bones tables for the generalised model, which is the focus of my question. Just the primary keys (and foreign keys for the junction tables) are shown:

ContactType(ct_id)
ContactMechanismType(cmt_id)
Valid_ContactType_ContactMechanismType(ct_id, cmt_id)

Contact(c_id)
ContactMechanism(cm_id)
Contact_ContactMechanism(c_id, cm_id)

The entity types "Person" and "Organisation" in the specific model are subtypes of "Contact" and instances of "ContactType", which is basically a discriminator/type entity in ER terms (?). My rationale for taking this approach is that the requirements for the actual model I'm working on have been very volatile and they're bound to change in the future as well. So I think it makes more sense to change records in "ContactType", for example, rather than keep adding/removing tables to the database.

Now, my issue: In the specific model, a Person can have only 1 Address and no POBox. In the generalised model, however, a Contact (which may be classified as a Person by its association with ContactType) may have many Addresses and many POBoxes, as the model stands.

The information for which ContactMechanismType is valid for each ContactType is stored in Valid_ContactType_ContactMechanismType. So, it is explicitly stated in terms of data, but how can I enforce it on the association table Contact_ContactMechanism (Rule 1 in diagram)? These are the options I can think of:

1. Use referential integrity constraints. The problem is that there are no foreign keys explicitly stated between the 2 tables. Contact_ContactMechanism(c_id, cm_id) would need to be turned to Contact_ContactMechanism(c_id, cm_id, ct_id, cmt_id) which would provide the foreign key (ct_id, cmt_id) to Valid_ContactType_ContactMechanismType(ct_id, cmt_id), but introduces redundant data (ct_id, cmt_id) in the Contact_ContactMechanism relation, along with a risk of ending up with inconsistent data.

A way I've thought around this is to let the identity of Contact be defined by its type plus a unique id for they type, i.e. (c_id, ct_id) being the primary key for Contact. Same goes for ContactMechanism(cm_id, cmt_id). In this case the junction tables is Contact_ContactMechanism(c_id, cm_id, ct_id, cmt_id) which contains a foreign key to Valid_Contact_ContactMechanism that can be used to enforce Rule 1. The problem with this approach is the extra storage space, the more complex queries, unknown consequences in interacting with applications (e.g. composite key + ORM?), plus conceptually I've coupled the identity of a Contact with its classification. Now I can't reclassify a Contact (e.g. from Person to Organisation) without changing its identity, which feels fishy.

2. Use a trigger or a stored procedure to check if I'm importing valid Contact - ContactMechanism tuples in the Contact_ContactMechanism table. But this does not feel satisfactory either and I'm pretty sure it's going to create performance issues in bulk insert situtations.

3. Enforce the rule in the application. This options takes the rule completely out of the database and if another application uses the database it may corrupt it unless it implements the rule itself.

So... these are my troubles. And only the easiest part because then there's the matter of enforcing the correct cardinality constraints between Contact and ContactMechanism, but this is a matter for another time. To all you experienced data modelers out there, is there a best-practice for handling these situations in the database? Any help will be greatly appreciated :)

Thanks,
Nico

SSRS #Error

$
0
0
Good day,

I have a problem in my SSRS Report where the #Error is being displayed

I have a matrix and in the textbox where the error is appearing I have a calculation: (A / B) * C

I have tried changing this to:
IIF(B = 0, 0, (A / B) * C)

That did not solve the problem

Then I tried:
IIF(ISNOTHING(B, 0, IIF(B = 0, 0, (A / B) * C))

And that to does not work

Can anyone help me with this please. I am pulling my hair out.

Reports showing ID of Field query shows name of field

$
0
0
I am trying to run graph on a report from query but what's happening is query shows name but report on graph shows ID'S of the field

Below is my query

SELECT tblMainTWTTPSheet.txtRootCause, Count(tblMainTWTTPSheet.txtRootCause) AS CountOftxtRootCause
FROM tblMainTWTTPSheet
GROUP BY tblMainTWTTPSheet.txtRootCause, tblMainTWTTPSheet.Date
HAVING (((tblMainTWTTPSheet.txtRootCause) Is Not Null) AND ((Count(tblMainTWTTPSheet.txtRootCause)) Is Not Null) AND ((tblMainTWTTPSheet.Date) Between [Forms]![frmStratificationOfRootCauses]![startDate] And [Forms]![frmStratificationOfRootCauses]![endDate]));

My bound coloum on main menu form and back end table is 1
coloum count 2
coloum width 0;1

Need to manipulate already opened Workbook from Access

$
0
0
Can't believe I'm stuck on this!

I want set focus to an open workbook and then do stuff with it.
Basically:

Code:

Workbooks("wb.xls").Activate  'This returns run time error 9, subscript out of range
'Code here for editing the workbook

What gives?
Viewing all 13329 articles
Browse latest View live