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

VBA paramaters throw compile error - expect line number of statement or end of stmt

$
0
0
I used to be a pro at Access VBA and writing code; but haven't done it in a while... I know this is something stupid and I'm having a brain fart; but would someone please help me figure out why I'm getting this error message when I call the function? It works fine when I take out the parameters.
Capture.JPG
Code:

Option Compare Database
Option Explicit


Public Function addzeros(nlength As Integer, sValue As String) As String
'Dim svlaue As String
'Dim nlength As Integer
Dim i As Integer
i=1
'sValue = "123"
'nlength = 6
stemp = sValue
If Len(sValue) < nlength Then
Do Until i = (nlength - Len(sValue))
        stemp = "0" & stemp
    i = i + 1
    Loop
End If
addzeros = stemp
Debug.Print stemp
End Function

Attached Images

Help with Er model

$
0
0
Hello, i need help with a database model which i need to complete. The scenario is about racehorses. Racehorse will have an owner, trainer, stable, and parents who are also racehorses, i also need to add where the horse has run and at what racecourse and its position and jockey who rode it. I understand how to add most of this to a model, however i am having trouble doing the races and parents. What entity and attributes could i have for these? thanks in advance and any help would be appreciated, thanks!:)

SPSS to EXCEL

$
0
0
May I convert SPSS file to EXCEL file?

Help with soccer Database norm - normalization

$
0
0
Hi,

New to the forum and database design. I've played around with databases before but nothing too serious. I'm watching some database for beginners lessons on youtube to try and get some knowledge.

Database Background

I'm looking to create a database that will hold soccer teams, competition, fixtures, results, half time score, full time score. The teams will be from all over the world, the competitions will be domestic and cross border (Champions League, Europa League).

Information that I'm looking to get out of the database

-Goals Per Game
-Goals Per Team
-Goals per Competition
-Games where both teams scored, per competition, team

I have a spreadsheet with data with the following headings

Country
Competition
Round
Season
Date
Home Team
Away Team
Home Half Time Score
Home Full Time Score
Away Half Time Score
Away Full Time Score
Results

I have taken these headings and created the following tables:

tblMatch
matchID - PK
matchDate
matchTime
seasonID - FK - tblSeason
competitionID - FK - tblcompetition
roundID - FK - tblRound


tblHomeTeam
matchID - FK - tblMatch
teamID - FK - tblTeam
HomeTeamHaflTimeScore
HomeTeamFulllTimeScore


tblAwayTeam
matchID - FK - tblMatch
teamID - FK - tblTeam
awayTeamHaflTimeScore
awayTeamFulllTimeScore


tblTeam
teamID - PK
teamName
teamNickName

tblSeason
seasonID - PK
seasonDesc
startDate
endDate

tblCompetition
competitionID - PK
competitionName
countryID - FK - tblCountry

tblRound
roundID - PK
roundName

tblCountry
countryID - PK
countryName

Looking for any comments on my normilization and if you think i've got it right. My main concerns are around the match and home and away teams. I've removed result as I think i can find that out via calculation of scores.

t

Hi I'm Mikk

$
0
0
Hi there,

My name is Mikk.
Me and my brother run a company which is engaged in engineering manufacturing,

the issue that I am facing is I am not able to manage my orders, inventory and work flow.
due to that I am facing so much problems coz my employees are not giving their 100%

the reason I'm here is I want to create a software that can be used in network.
here is my process

1 we get the inquiry
2 we provide quotation + drawing (both are having unique numbers and we keep hard copy and soft copy of both)
3 we get the purchase order
4 I've initially created a excel sheet that is used to make 3 sheet at once which is Sales order + Job Card + Bill Of Material (this also has a unique number )
4.1 Sales Order : SO - is used only for office in it contains each information
4.2 Job Card : JC - is used only for workshop and it has product related information party name is not mentioned in that
4.3 Bill Of Material : BOM - is also used for workshop and it is used to provide needed items from the inventory to make such product.

all three documents are having a unique number that is used to follow that production process.

I want to make such application which is easy to use and can be used specifically for my purpose, I want to develop a app that is GUI based and Editable.. for my enhancement regarding productivity.

I HOPE YOU ALL GUYS WILL HELP ME ACHIVE MY GOAL....

variation of n_live_tup value on the table having 1:1 relationship

$
0
0
Hi Team,

I need a clarification on 'n_live_tup' column available in the predefined table 'pg_stat_user_tables'.

I have two tables having one to one relationship, i.e., each row in TableA has its corresponding row in the TableB . Upon inserting or updating a row in Table A , trigger defined on Table A will make sure of inserting / updating a row in Table B.
I also confirm that i have same number of rows in both the tables.

But when ran the below SQL statement i could see a huge difference of 'n_live_tup' value.

select relname , n_live_tup,n_dead_tup from pg_stat_user_tables ;

n_live_tup - Table A(parent table) shows '159037' , TableB is showing '1428582'
the value of n_dead_tup is zero for both the tables.

Can some one help me out by explaining why this is happening. Am i missing any basic theory here ( am new to postgres).

Regards,
Harika

Computer store inventory system help.

$
0
0
So far I have created the ER-model and I have those entities:
Supplier-Items-Inventory-Requests-Order-Customer

Now, when I want to do the physical design I'm confused on how to do transactions. the doctor told me to add invoice entity but how to make the database work?
I mean how to create an invoice for a customer?

MS Access Multiple Field Average with criteria?

$
0
0
Hi All,
could use some help with what initially seemed liike a pretty easy query, that I just cant seem to think my way through at the moment…
I have a table, with lots of data (many many many records) that I have calculated and filtered into a single query… all good so far….

Now I need to work out the average 'Sales' per hour, per day, per financial week for the current year and those that came previously.... eg, if the DateTime is 23/12/2013 10:01:00, then i need the average sales for 2013/2012/2011, where the week number is 52, the day of the week is 6 (Friday) and the TimeSlot is 10:01...
I'm pretty sure that i need to do something with a subquery for this one, as none of the more straight forward methods i've tried seem to work, i do know how to perform this calculation in Excel, but i can't for the life of me work out how to transfer this to Access..=AVERAGEIFS(Sales,Years,"<="&C3,Weeks,D3,D ays,E3,TimeSlot,F3)

Sorry about the formatting, but i've included a sample of the query data... The year column actually runs 2011-2015, the Weeks Column runs 1-52/53, the days column runs 1-7 and the time slots run 00:01-23:01...

1____________A____________ B_______C________D___________E_________F
2______DateTime___________Years___Week__DayOfWeek_ __TimeSlot___Total Sales___Expected Result
3______18/12/2011 10:01____ 2011____52_______1________ 10:01:00______40___________40.00
4______20/12/2011 10:01____ 2011____52_______3________ 10:01:00______37___________37.00
5______21/12/2011 10:01____ 2011____52_______4________ 10:01:00______38___________8.00
6______22/12/2011 10:01____ 2011____52_______5________ 10:01:00______40___________40.00
7______23/12/2011 10:01____ 2011____52_______6________ 10:01:00______41___________41.00
8______19/12/2011 10:01____ 2011____52_______2________ 10:01:00______39___________39.00
9______24/12/2011 10:01____ 2011____52_______7________ 10:01:00______34___________34.00
10_____23/12/2012 10:01____ 2012____52_______1________ 10:01:00______37___________38.50
11_____24/12/2012 10:01____ 2012____52_______2________ 10:01:00______38___________38.50
12_____25/12/2012 10:01____ 2012____52_______3________ 10:01:00______16___________26.50
13_____26/12/2012 10:01____ 2012____52_______4________ 10:01:00______30___________34.00
14_____27/12/2012 10:01____ 2012____52_______5________ 10:01:00______34___________37.00
15_____28/12/2012 10:01____ 2012____52_______6________ 10:01:00______36___________38.50
16_____29/12/2012 10:01____ 2012____52_______7________ 10:01:00______32___________33.00
17_____22/12/2013 10:01____ 2013____52_______1________ 10:01:00______40___________39.00
18_____23/12/2013 10:01____ 2013____52_______2________ 10:01:00______31___________36.00
19_____24/12/2013 10:01____ 2013____52_______3________ 10:01:00______35___________ 29.33
20_____25/12/2013 10:01____ 2013____52_______4________ 10:01:00______14___________ 27.33
21_____26/12/2013 10:01____ 2013____52_______5________ 10:01:00______29___________ 34.33
22_____27/12/2013 10:01____ 2013____52_______6________ 10:01:00______36___________ 37.67
23_____28/12/2013 10:01____ 2013____52_______7________ 10:01:00______37___________ 34.33
24_____27/12/2014 10:01____ 2014____52_______7________ 10:01:00______37___________ 35.00
25_____21/12/2014 10:01____ 2014____52_______1________ 10:01:00______38___________ 38.75
26_____22/12/2014 10:01____ 2014____52_______2________ 10:01:00______37___________ 36.25
27_____23/12/2014 10:01____ 2014____52_______3________ 10:01:00______37___________ 31.25
28_____24/12/2014 10:01____ 2014____52_______4________ 10:01:00______37___________ 29.75
29_____25/12/2014 10:01____ 2014____52_______5________ 10:01:00______15___________ 29.50
30_____26/12/2014 10:01____ 2014____52_______6________ 10:01:00______27___________ 35.00





Any pointers, methods or assistance in making my brain work again would be happily and gratefully received!!!

Regards

Brujah

What errors can be avoided?

$
0
0
Does anyone know what errors can be avoided by using input masks and control tools?

Macro help

$
0
0
Hi there.
This is outside of my scope, but I'm trying to do it w/o much luck. Hopefully someone here can help

I have an excel export for which row 1 has 3 values (columns)

A B C
APT-111 12222 111.47

I need it to display like this

A B
APT-111 12222
APT-111 111.47

This would be for the entire sheet.

Any help would be greatly appreciated.

What is the most frequently used word in a column of open text?

$
0
0
Here is an interesting piece of data that I am trying to obtain. The company I work for sells products online. We have a table that stores the product descriptions that are visible to the users: "this lovely widget was handcrafted in widgetsville...". I am wondering if there is a way to search through this field for all products and see what are the most commonly used words across all descriptions and how many instances of this word are there. For example, of the 10,000 item descriptions, the word "widget" appears 15,000 times.

Order Counts by hour, with hours that have no data and need to show 0

$
0
0
Hello,

I have a month's worth of data to count by hour. most hours have data, some do not. when i count them by hour, i might not get all 24 rows as no data for an hour means it will not have a row. I still need the row, and it should show 0.

sample data

Code:

WITH tbl1 (dd1, hr1, value1) AS (
  VALUES
    ('2015-12-01', '00', '1234')
  , ('2015-12-01', '02', '2345')
) (
  SELECT dd1, hr1, value1
  FROM tbl1
) WITH UR

this results in:

Code:

2015-12-01        00        1234
2015-12-01        02        2345

I need to fabricate hour "01" with "0" for the value. I came up with this.

Code:

WITH tbl1 (dd1, hr1, value1) AS (
  VALUES
    ('2015-12-01', '00', '1234')
  , ('2015-12-01', '02', '2345')
), tbl2 (dd2, hr2, value2) AS (
  VALUES
    ('2015-12-01', '00', '0')
  , ('2015-12-01', '01', '0')
  , ('2015-12-01', '02', '0')
) (
  SELECT COALESCE(dd1, dd2), COALESCE(hr1, hr2), COALESCE(value1 , value2)
  FROM tbl1
  RIGHT OUTER JOIN tbl2 ON dd1=dd2 AND hr1=hr2
) WITH UR

this results what i need:

Code:

2015-12-01        00        1234
2015-12-01        02        2345
2015-12-01        01        0

but it is not scalable because every column in the original data needs to show up in the temp table, enlarging it exponentially with every field that it's grouped by. this example is dumbed down so no aggregation is present but it's simpler for ease of understanding.

I can only do a select, but since this is going in excel, an excel solution to fill in the blanks would work as well. it actually needs to go in iSeries db but i can translate it later. I just need to get the logic down.

please advise what the best way to do this.. right in db2/iseries, or excel or anywhere else, and briefly what a method might look like?

thanks,
-don

Sum Vlookup

$
0
0
I'm trying to sum multiple sheets using the vlookup command. I can get my formula to sum everything between Sheet1 and Sheet2 with
Code:

=SUM(Sheet1:Sheet2!$J$40)
and also get the vlookup to lookup what data i want with
Code:

=VLOOKUP(B3,'12-06-2015'!B6:J39,9,FALSE)
Now i want to get a sum of the values in the lookup between sheet1 and sheet2. All of the sheets in this workbook are named for dates, 11-29-2015, 12-06-2015, etc. Everything i find through searching says to use SUMIF, I've never used SUMIF so i'm not sure how to proceed. B6 to J39 is where all the data is located. Any help would be greatly appreciated.

Credit Suisse: Opportunities in Technology (IT) across New York and Raleigh

$
0
0
You are fascinated by the technologies that make the world move. We’ll give you the opportunity to make an immediate impact within the world of technology at Credit Suisse.

The Technology (IT) Division is committed to fueling Credit Suisse’s growth. Technology partners closely with the business to deliver innovative and cost-efficient results. In today’s competitive environment, Technology drives performance and revenue growth. By directly aligning our Technology initiatives with the bank’s overall business objectives, Technology helps provide Credit Suisse with a distinct competitive advantage.

Whether it is delivering the fast trading programs for clients, designing solutions to improve the bank’s overall efficiency, or providing global, standardized infrastructure, technology professionals help Credit Suisse become one of the most admired banks.

We are currently hiring across the New York and Raleigh. To find out more about the following positions in IT and apply online please visit our Careers Site: https://express.candarine.com/campai...d/2202457dfcba

Uplete (update/delete) in one statement

$
0
0
Hi,
I'm very new to PostgreSQL but I need to perform some (complex?) operations on PostgreSQL 9.4.5... The first was an UPSERT, whereby I was inserting new data (word occurrences) or updating occurrence counts, and which I adapted off the Internet as follows:
Code:

WITH newbatch (normalized, original, count) as ( VALUES
('room','room',1)
),
upsert as (
  UPDATE normalized_forms m SET count = m.count + 1
    FROM newbatch nb WHERE m.original = nb.original
  RETURNING m.*
)
INSERT INTO normalized_forms (normalized, original, count)
  SELECT normalized, original, count FROM newbatch
  WHERE NOT EXISTS (
    SELECT 1 FROM upsert up
      WHERE up.original = newbatch.original
  );

This works fine. Now I need to do the opposite, i.e. decrease occurrence counts and, when one reaches 0, delete the corresponding row. I'm getting the entries to delete/update from another table. I've gotten as far as decreasing counts, but it doesn't perform the last part of my statement which should take care of the deletion. Here's what I have so far:
Code:

WITH oldbatch (normalized, original, count) as (
  SELECT original, count from all_words
  WHERE id_doc='xxx'
),
uplete as (
  UPDATE normalized_forms m SET count = m.count - ob.count
    FROM oldbatch ob WHERE m.original = ob.original
)
DELETE FROM normalized_forms
  WHERE count = 0
;

As I said, it needs to be a single statement, and I expect it could/should be very similar to the UPSERT I'm using. Can anyone help me add the last strokes so it does what it should?

Thanks!

David

Urgent, Please help in SQL Queries

$
0
0
Scenario: The database “Cellphones Information” contains details on cell phone sales or transactions.

Details stored are: Dim_Manufacturer, Dim_Model, Dim_Customer, Dim_Location and Fact_Transactions. The first four store entries for the respective elements and Fact_Transactions stores all the information about sales of specific cellphones.


Table Structure : Please find the file attached.

Need queries for following:

1. What state in the US is buying more 'Samsung' cell phones? Display state and number of cell phone transactions, sort by state.

Keep in mind that some manufacturers can be stored in this format: “Name of Manufacturer - Country Code” (e.g. Samsung – Chile, Samsung – Peru, Motorola – Brazil). Also, some of them can be stored in uppercase or lowercase.

2. Show the number of transactions for each model per zip code per state. Display manufacturer, model name, state and zip code, even if there are no transactions for a model. Sort by manufacturer name.

3. Find out the average price for each model in the top 5 manufacturers in terms of sales quantity, and order by average price;

4. List if there is any model that was in the top 5 in terms of quantity, simultaneously in 2008, 2009 and 2010;

5. List the names of the customers and the average amount spent in 2009, where the average is higher than 500.00;

6. List all the states in which we have customers who have bought cellphones from 2005 till today;

7. Show the manufacturers that sold cell phones in 2010 but didn’t in 2009.

It is urgent, I am very thankful if you respond immediately with your answers.

Thanks a lot!
Akriti.
Attached Images

Time Series DBMS

$
0
0
Hi all,

I am focusing on time series database management system, and would like to learn from you guys and share my thoughts as well if possible. Thanks.

I am currently working at a startup that developed time series DBMS that can process 1 million TPS on a single server. It can be an alternative to the conventional DBMS, but we aim to develop a DBMS that can process all kinds of big data. We would like to do it by providing multi-nodes and parallel query.

Error compiling PLL in forms 11gr2

$
0
0
When I try to compile a PLL in oracle forms and reports 11gr2, i get the following error:
PDE-PL1011 - A tools common schema table is missing from the object store

Please help with this error. Tried google to no avail. Thanks in advance.

Mike

Selecting ids with null values.

$
0
0
Hi,

I have a table Employee with 3 columns.

emp_Id | begindate | Enddate
001 2013-01-01 2013-12-31
001 2014-01-01 2014-12-31
001 2015-01-01 null
002 2013-01-01 2013-12-31
002 2014-01-01 2014-12-31
002 2015-01-01 null
003 2013-01-01 2013-12-31
003 2014-01-01 2014-12-31


enddate gets updated after the end of every year. Employees are active when the enddate is not null against their ods. i.e. employee 001 and 002.

When the enddate is null, the employees do not exist in the company anymore. Inactive. i.e. 003.

I would like to fetch employeeId and their latest status.

emp_id | status

001 active
002 active
003 inactive

Thank you in advance

Query needed urgently :- fetching latest status of Employees

$
0
0
Hi,

I have a table Employee with 3 columns.

emp_Id | begindate | Enddate
001 2013-01-01 2013-12-31
001 2014-01-01 2014-12-31
001 2015-01-01 null
002 2013-01-01 2013-12-31
002 2014-01-01 2014-12-31
002 2015-01-01 null
003 2013-01-01 2013-12-31
003 2014-01-01 2014-12-31


enddate gets updated after the end of every year. Employees are active when the enddate is not null against their ods. i.e. employee 001 and 002.

When the enddate is null, the employees do not exist in the company anymore. Inactive. i.e. 003.

I would like to fetch employeeId and their latest status.

emp_id | status

001 active
002 active
003 inactive

Thank you in advance
Viewing all 13329 articles
Browse latest View live