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

Access VB Code Help

$
0
0
I am fairly good with general code in access. Where my knowledge falls short is anything that has to do with the FOR command and I believe thats where I am at now.

I have a table with 3 columns A, B, C
A is the primary key

I want to populate every record in columns B & C with code when a form control [ControlA] OnChange event fires.

This is where I believe I need the FOR each record command to do this!

Another problem is I need the math to be like the following:
Column B = [ControlA]*Column A
Column C = [ControlA]*[ControlB]*[ControlC]*Column A

I am sure this is some type of update query or similar situation, but figured i would ask which direction to go before I get lost ;)

I am not sure how I add Column A into the equation!

Any help or direction would be greatly appreciated.

Thanks,
Don

How to list all databases

$
0
0
Universal DB2 on NT:

I have like 10 instances with around 6 databases in each instance. Is there a way to make a list of all the databases to a text file ?


New to DB2.

MQT based on Table with CLOB

$
0
0
I am trying to create an MQT with DB2 9.7, the MQT is using a full select from a table that has several CLOBS. Since MQT's do not support CLOBs I am trying to cast the CLOB to a varchar, however, no matter what I do I cannot convert the CLOB to a varchar and keep getting an error on the create table (MQT). The code is:

CREATE TABLE COGNOS.PD (
ENTITY_CODE,
DESCRIPTION)

AS (

SELECT
PD.ENTITY_CODE,
cast(PD.DESCRIPTION as VARCHAR(5000))

FROM
SMS.PD PD

) DATA INITIALLY DEFERRED
REFRESH DEFERRED
ENABLE QUERY OPTIMIZATION
MAINTAINED BY SYSTEM
NOT LOGGED INITIALLY
IN TSMQT8K INDEX IN TSMQT8K

The error code is:
The fullselect specified for the materialized query table "COGNOS.PD" is not valid. Reason code = "3".. SQLCODE=-20058, SQLSTATE=428EC, DRIVER=4.13.111

Is there anything I can do in order to include the data from a CLOB in my MQT? Any conversion that can be done?

SQL w/ Access GUI front end

$
0
0
I have a small SQL database, I want to make a front end GUI for it. VERY basic kind of stuff that basically just allows the user to input data into the GUI which basically just inserts data into the tables from the SQL database. I have the SQL database loaded into Access. I split the database which i think I was supposed to do?? Not sure If i was wrong let me know.

I think I need to usa Visual basic to make the page? I tried tinkering around but I cant seem to find the right instructions online. I basically am just trying to make an Access front end with a GUI that has a couple text boxes that the user will input data into, which will then save into the data to the back end SQL.

Anyone have any direction then can help point me? or if im am just COMPLETELY wrong in doing this that would also be nice to know lol I just thought Ive seen this done somewhere.

jdbc connection problems

$
0
0
Hi All,

I try to run a JAVA program with a connection to SQL Server 2012.
This program works very well with MySQL, Oracle and DB2.
But I have problem with SQL Server:

Code:

Caused by: org.hibernate.HibernateException: 'hibernate.dialect' must be set when no Connection available
        at org.hibernate.dialect.resolver.DialectFactory.buildDialect(DialectFactory.java:106)
        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:148)
        at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2833)
        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2829)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1840)
        at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902)
        ... 51 more

My connection parameters are stored in propertie file :
Code:

Url=jdbc:sqlserver://NASSA\\SQLEXPRESS:1433;database=MyDB
Username=nassa
Password=nassa
DriverClassName=com.microsoft.sqlserver.jdbc.SQLServerDataSource

These parameters are copied to a datasource.

I use sqljdbc4.jar driver file.

I have no problem to connect to my database with oqsl.exe or sqlcmd.exe:
Code:

>sqlcmd -S NASSA\SQLEXPRESS -U nassa -P nassa -d MyDB
Thanks for your help.

Nassa.

How to apply color to legend of chart

$
0
0
Hi,

I am using some Reason Codes for particular time spam .

No of Reason codes differs for different time spam.

In this scenario how to keep color consistency of Legend of Crystal Report

usage of hash function

$
0
0
i am trying to generate unique value for 10 columns in a table.
for that i used hash function.

but hash function is returning same value for both the strings.

ex :-
select
DBMS_UTILITY.get_hash_value ('150/65271/5/3//44335/M/3//19830221000000/19830327000000/11697/121702/291701//1/19830221000000/19830327000000//8/10890/18/1222841', 37 , POWER(2,16)-1) hash_val,
DBMS_UTILITY.get_hash_value ('150/110293/5/7//78374/164 Titles/7//20140101000000/20140930000000/67226/172168/613129//2/20140101000000/20140930000000//8/509/43/1783801', 37 , POWER(2,16)-1) hash_val1
from dual;

can any one please suggest how can i generate Unique value?.

Buttons Icons

$
0
0
Hi guys.

You might find these handy. See attached image.
A while back I've added a number of additional icons to the default set.

The icons were free from Tango Icon Library - Tango Desktop Project
I just selected the ones most applicable to Brilliant Database and verified they all worked. Which is important because if you load one that does not work, it can have all manger of strange problems.

Regards
James

Attached Images
File Type: jpg icons.jpg (172.7 KB)
Attached Files
File Type: zip icons.zip (49.8 KB)

Query to display weekly data

$
0
0
I have a table with following data:
Sale_date Qty_sold
---------- ----------
01-Apr-2013 10
02-Apr-2013 0
03-Apr-2013 0
04-Apr-2013 0
05-Apr-2013 12
06-Apr-2013 0
07-Apr-2013 0
08-Apr-2013 15
09-Apr-2013 23
10-Apr-2013 0

Now i would like to display the weekly qty_sold for a given date range.

Say if date_range is ’01-apr-2013’ to ’08-apr-2013’ then it will consider first week from ’01-apr-2013’ to ’07-apr-2013’ and 2nd week from ’08-apr-2013’ to ’08-apr-2013’ and result will be as below

Week tot_qty_sold
----- ----------
1 22
2 15

If date_range is ’02-apr-2013’ to ’10-apr-2013’ then it will consider first week from ’02-apr-2013’ to ’08-apr-2013’ and 2nd week from ’09-apr-2013’ to ’10-apr-2013’ and result will be as below

Week tot_qty_sold
------- -----------
1 27
2 23


Regards,
JD

Issues with tablespace

$
0
0
Hi all,

In our setup db2 V9.7 with fixpack 4

Facing issues with tables..

create the table using this DDL:
=======================

CREATE TABLE "db2STG"."TIS_DA_ALDIS_SPD_DATA" (
"ROW_NBR" INTEGER NOT NULL,
"SRC_FILE_NM" VARCHAR(50) NOT NULL,
"DATA_SRC_CD" CHAR(5) NOT NULL,
"ETL_BATCH_ID" CHAR(14) NOT NULL,
"DATA_TYP" VARCHAR(500),
"TIS_DATA_RQST_ID" VARCHAR(500),
"SITE_XN_ROUTE_NBR" VARCHAR(500),
"LOC_LEG_NBR" VARCHAR(500),
"SRVY_DT" VARCHAR(500),
"SRVY_TM" VARCHAR(500),
"TRVL_SPD" VARCHAR(500),
"VEH_LGTH" VARCHAR(500),
"INS_TMS" TIMESTAMP NOT NULL,
"INS_USR" VARCHAR(30) NOT NULL,
"UPD_TMS" TIMESTAMP,
"UPD_USR" VARCHAR(30)
)
DATA CAPTURE NONE
IN "ALTIS_SPD_TAB"
DISTRIBUTE BY HASH ("ROW_NBR", "SRC_FILE_NM", "DATA_SRC_CD")
COMPRESS NO;

ALTER TABLE "db2STG"."TIS_DA_ALDIS_SPD_DATA" ADD CONSTRAINT "TIS_DA_ALDIS_SPD_DATA_PK" PRIMARY KEY
("ROW_NBR",
"SRC_FILE_NM",
"DATA_SRC_CD");



By using the tablespace "ALTIS_SPD_TAB"


Issues:
======

I generate the DDL but I won't the tablepace name?? But select the tablespace clause..


Thanks,
laxman..

LOAD_SCRIPT and deletion of log files

$
0
0
Gents, I have a strange (to me anyway) issue.

I have a job (JOB A) that calls a number of different jobs. One of these called jobs (JOB B) has the following step:

#================================================= ================
# STEP 05. Load into staging table
#================================================= ================
STEP
. ${LOAD_SCRIPT}
ENDSTEP

...the LOAD_SCRIPT is this: LOAD_SCRIPT=${WFM_BIN}/bulkload_${TABLENAME}_ld.ksh

...so, as you can see these simply load data via db2 load commands. In JOB B i use this: LOAD_ERR=${EDR_LOG}/${JOBNAME}_load_errors.log to capture DB2 messages. The issue is, i can delete the logs upon successful completion by putting in a rm -f command in JOB A...but, why cant i put this rm in JOB B instead?- I would like the JOB B which creates the logs to also be the job that removes them. If i do, it does not remove the logs...it only removes the logs when JOB A has the rm command. I thought maybe the LOAD_SCRIPT has a hold on the logs but i would think the ENDSTEP should be releasing it. Of course the rm command is at the very bottom of JOB B.

Thanks
B

Fill up text box from value selected in combobox

$
0
0
I am working with MS Access 2007. I have a table that contains student names corresponding to student IDs. I have student IDs in another relationship table and a form that has a combobox that contains all the student IDs from the relationship table. What I want to be able to do is, upon selection of a student ID from the combobox, another text box in the same form will be automatically filled up with the student name by looking up the student table. I have been trying to achieve this since last night so any help will be highly appreciated. Thanks

Query Optimization required

$
0
0
A ref type cursor is created in a procedure; select query used is defined below. Please help to reduce the execution time of this query.

OPEN arm_cure_acct_collectables_cv FOR
SELECT /*+ rule */ AC.account_no,
d_null,
d_null,
d_null,
SUM(CB.balance_due + CB.dispute_amt) balance,
AC.tracking_id,
AC.tracking_id_serv,
AC.ext_event_id,
AC.ext_event_type,
AC.collectable_id,
AC.collectable_serv,
C.currency_code
FROM CMF_BALANCE CB,
CMF C,
ARM_COLLECTABLE AC,
BH_ARM_THRESH_PARAMETERS BATP
WHERE CB.account_no = C.account_no
AND (CB.bill_ref_no = 0 OR
--CB.ppdd_date <= dateadd('day', 0 - BATP.grace_period, TRUNC(SYSDATE)))
CB.PPDD_DATE <= (TRUNC(SYSDATE)-BATP.GRACE_PERIOD))
AND AC.account_no = C.account_no
AND AC.account_no > 0
AND (( C.collection_indicator =1 AND AC.apn_tracking_id IS NULL) OR (C.collection_indicator =0 AND AC.apn_tracking_id IS NOT NULL))
AND BATP.BUSINESS_UNIT = (SELECT BU.PARAM_VALUE
FROM CMF_EXT_DATA BU
WHERE BU.ACCOUNT_NO = C.ACCOUNT_NO
AND BU.PARAM_ID = v_business_unit)
AND BATP.CUSTOMER_TYPE = (SELECT CT.PARAM_VALUE
FROM CMF_EXT_DATA CT
WHERE CT.ACCOUNT_NO = C.ACCOUNT_NO
AND CT.PARAM_ID = v_customer_type)
AND (BATP.CUSTOMER_CLASSIFICATION = (SELECT CC.PARAM_VALUE
FROM CMF_EXT_DATA CC
WHERE CC.ACCOUNT_NO = C.ACCOUNT_NO
AND CC.PARAM_ID = v_customer_class)
OR BATP.CUSTOMER_CLASSIFICATION IS NULL)
AND (BATP.PRODUCT_TYPE = (SELECT PT.PARAM_VALUE
FROM CMF_EXT_DATA PT
WHERE PT.ACCOUNT_NO = C.ACCOUNT_NO
AND PT.PARAM_ID = v_product_type)
OR BATP.PRODUCT_TYPE IS NULL)
AND (BATP.CREDIT_SCORE = (SELECT CS.PARAM_VALUE
FROM CMF_EXT_DATA CS
WHERE CS.ACCOUNT_NO = C.ACCOUNT_NO
AND CS.PARAM_ID = v_credit_score)
OR BATP.CREDIT_SCORE IS NULL)
AND BATP.CURRENCY_CODE = C.CURRENCY_CODE
AND (BATP.MKT_CODE = C.MKT_CODE OR BATP.MKT_CODE IS NULL)
AND (BATP.ACCOUNT_CATEGORY = C.ACCOUNT_CATEGORY OR BATP.ACCOUNT_CATEGORY IS NULL)
AND (BATP.VIP_CODE = C.VIP_CODE OR BATP.VIP_CODE IS NULL)
GROUP BY AC.account_no, C.currency_code, C.account_status,AC.tracking_id,
AC.collectable_id,AC.tracking_id_serv, AC.ext_event_id,AC.ext_event_type,
AC.collectable_serv,exit_thresh_amt,BATP.exit_thre sh_pct
HAVING (SUM(CB.balance_due + CB.dispute_amt) <= (GREATEST(BATP.exit_thresh_amt,
BATP.exit_thresh_pct * (SELECT ED.param_value
FROM CMF_EXT_DATA ED
WHERE ED.account_no = AC.account_no AND
ED.param_id = v_col_enter_bal /*ID of Col_Enter_Bal*/ )/100 ))
AND C.account_status < 1) OR (SUM(CB.balance_due + CB.dispute_amt) <= 0 AND C.account_status > 0);

DoCmdRunSQL vs DoCmdOpenQuery

$
0
0
Simple question: which one of these is more efficient, do you think?

Code:

DoCmd[dot]RunSQL("DELETE * FROM tblCustomers")
Or

Code:

DoCmd.OpenQuery "qryDelCustomers", acViewNormal, acEdit

...any thoughts? :angel:

Also, I just...typed in [dot] there because dbForums kept bleeping out my text for some reason .

Convert Date to numbers

$
0
0
Hi

How to convert the date NOW to integer..?

Thanks in advance
Any reply would be much appreciated,,,

ddlgen problem

$
0
0
I am writing a migration script and need to use sybase ddlgen tool to extract database object definitions. The tool is not generating ddl correctly for tables with identity column. Has anyone stumbled on the problem and is there any solution or ways around it.

This is how the DDL is been generated. In this example CustomerID is meant to be an identity column in the source database.

create table Customer (
CustomerID numeric(10,0) null,
.....
constraint pk primary key (CustomerID)
)

Thanks

does informix pdo support return of result set from stored procedure?

$
0
0
Can anyone tell me if informix pdo supports retrieving a result set from a stored procedure in the normal way?

It's telling me there are a wrong number of parameters. I've got the right number of input params. the output is a result set not a param. don't you get this using fetchAll()?

I've seen elsewhere that this is possible for other databases.

List box showing my reports and a cmd button to print them

$
0
0
I have a form with a list box that lists all of my reports. I also have two cmd buttons one, one to print the report and one to view the report. In the query for the list box im using Name: Right(Table1!TextField,Len(Table1!TextField)-3) since my reports are named rptReport_One and I want it to show as Report_One. My issue is when I click my buttons it says the report name is misspelled since its looking for rptReport_One and not Report_One.

To Print
Code:


Private Sub cmdPrintReport_Click()

If Nz(Me.ListBoxForReports, "") <> "" Then
  DoCmd.OpenReport ListBoxForReports, acNormal
Else
  MsgBox ("You Must First Select a Report To Print!")
  Me.ListBoxForReports.SetFocus
End If

  Me.ListBoxForReports = Null
End Sub

To Open
Code:

Private Sub cmdOpenReport_Click()
If Nz(Me.ListBoxForReports, "") <> "" Then
    DoCmd.OpenReport ListBoxForReports, acViewReport
Else
    MsgBox ("You Must First Select a Report to Open!")
    Me.ListBoxForReports.SetFocus
End If
    Me.ListBoxForReports = Null
End Sub

Do i need to add the Right function to my code? And if so how would I do that?

The easier way is to kill the naming integrity I have and just name the reports Report_One but I really don't want to do that.

Two field count query

$
0
0
Good afternoon.

I am very rusty on SQL and Access, so bear with me.

I have a query where I would like to get a total count for two fields.

Example:

table name: Mishap Data
Fields: Days Away From Work and Job Restrictions

I would like the query to return a count on how many records have a YES in either one of these two fields. One record might have a YES in both of these fields, but I don't want the query to count these as two.

I figure this would have to be done with some sort of IIF cmd.

Confusing?

Mark

Which one is best for seo -Joomla or wordpress?

$
0
0
Hi friends,

Pls. suggest me . which one is best for seo purpose website develop in joomla or wordpress.?
Viewing all 13329 articles
Browse latest View live