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

How To Add Class To Table InstructorCourses

$
0
0
I need to make schedule for Instructor include

day,time,date time,courses,classes(lab or class room),instructor


so that i designed my database as following

my relations as following

Instructor with courses many to many

class with instructor many to many

Relation between class and instructor many to many because

instructor can teach in more classroom and class room can have

more instructor






Code:

CREATE TABLE [dbo].[Courses](

    [CourseID] [int] IDENTITY(1,1) NOT NULL,

    [CourseName] [nvarchar](50) NOT NULL,

 CONSTRAINT [PK_dbo.Courses] PRIMARY KEY CLUSTERED

(

    [CourseID] ASC

)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

 

CREATE TABLE [dbo].[Class](

    [ClassID] [int] IDENTITY(1,1) NOT NULL,

    [ClassName] [nvarchar](50) NOT NULL,

 CONSTRAINT [PK_dbo.Class] PRIMARY KEY CLUSTERED

(

    [ClassID] ASC

)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

 

CREATE TABLE [dbo].[Instructor](

    [InstructorID] [int] IDENTITY(1,1) NOT NULL,

    [IstructorName] [nvarchar](50) NOT NULL,

 CONSTRAINT [PK_dbo.Instructor] PRIMARY KEY CLUSTERED

(

    [InstructorID] ASC

)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

 

CREATE TABLE [dbo].[InstructorCourses](

    [CourseID] [int] NOT NULL,

    [InstructorID] [int] NOT NULL,

    [fromtime] [nvarchar](50) NULL,

    [totime] [nvarchar](50)  NULL,

    [day] [nvarchar](50) NULL,

 CONSTRAINT [PK_dbo.InstructorCourses] PRIMARY KEY CLUSTERED

(

    [CourseID] ASC,

    [InstructorID] ASC

)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

CREATE TABLE [dbo].[Instructor_Class](

    [ClassID] [int] NOT NULL,

    [InstructorID] [int] NOT NULL,

 CONSTRAINT [PK_dbo.Instructor_Class] PRIMARY KEY CLUSTERED

(

    [ClassID] ASC,

    [InstructorID] ASC

)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]

To make schedule for instructor i make relation between Instructor

table and Courses table many to many and generate third table

InstructorCourses table have InstructorID and CourseID

But
How to add ClassID to table InstructorCourses although Class table have relation many to many with table Instructor

SQL union

$
0
0
I am making a small soccer prediction website and one functionality I need is to generate a league table from my database that contains past results. My db has 5 columns;

Fixture_ID.

Home_team.

Away_team.

Htgoals( Number of goals scored by home team).

Atgoals( Number of goals scored by away team).

I have two queries that return the league tables for teams only when playing at home and playing away from home


Home-" Select results.Home_team,
SUM(if(results.Htgoals > results.Atgoals,3,0)) AS W,
SUM(IF(results.Htgoals = results.Atgoals,1,0)) AS D,
SUM(IF(results.Htgoals < results.Atgoals,1,0)) AS L
from results
GROUP BY results.Home_team
order by W desc";

Away table-" Select results.Away_team,
SUM(if(results.Atgoals > results.Htgoals,3,0)) AS W,
SUM(IF(results.Atgoals = results.Htgoals,1,0)) AS D,
SUM(IF(results.Atgoals < results.Htgoals,1,0)) AS L
FROM results
GROUP BY results.Away_team
ORDER BY W DESC";



How can I;

1.Do a union to generate an overall league table

2.Rank teams by the number of points rather than number of wins

3. I would like to include a fixtures table in the db, what is the best way of making the db (fixtures and results table) relational (foreign keys)

Unexpected failure in transactions with isolation level serializable

$
0
0
Hi,

I have a challenge with transactions in Postgresql when they have the isolation level SERIALIZABLE.

This is the transaction table and data:
Code:

CREATE TABLE "test_transaction"
(
  "id" bigserial PRIMARY KEY,
  "other_id" bigint NOT NULL,
  "created_time" timestamp with time zone NOT NULL DEFAULT now(),
  "updated_time" timestamp with time zone NOT NULL DEFAULT now()
);

INSERT INTO "test_transaction"
        ("id", "other_id")
        VALUES
        (1, 1),
        (2, 2),
        (3, 1),
        (4, 2),
        (5, 1),
        (6, 2);;

Start transaction A:
Code:

BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ WRITE;
start transaction B:
Code:

BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ WRITE;
Select the last transaction with "other_id"=1 in transaction A:
Code:

select
  "test_transaction"."id",
  "test_transaction"."other_id",
  "test_transaction"."created_time",
  "test_transaction"."updated_time"
from
  "test_transaction"
where
  "test_transaction"."other_id" = 1
order by
  "test_transaction"."updated_time" desc limit 1;

Select the last transaction with "other_id"=2 in transaction B:
Code:

select
  "test_transaction"."id",
  "test_transaction"."other_id",
  "test_transaction"."created_time",
  "test_transaction"."updated_time"
from
  "test_transaction"
where
  "test_transaction"."other_id" = 2
order by
  "test_transaction"."updated_time" desc limit 1;

Update "updated_time" where id = 1 in transaction A:
Code:

update
  "test_transaction"
set
  "updated_time" = now()
where
  "test_transaction"."id" = 5
returning
  "test_transaction"."id",
  "test_transaction"."other_id",
  "test_transaction"."created_time",
  "test_transaction"."updated_time";

Update "update_time" where id = 2 in transaction B:
Code:

update
  "test_transaction"
set
  "updated_time" = now()
where
  "test_transaction"."id" = 6
returning
  "test_transaction"."id",
  "test_transaction"."other_id",
  "test_transaction"."created_time",
  "test_transaction"."updated_time";

Commit transaction A:
Code:

COMMIT;
Commit transaction B:
Code:

COMMIT;
Recieve an error in transaction B
Code:

ERROR: could not serialize access due to read/write dependencies among transactions
SQL state: 40001
Detail: Reason code: Canceled on identification as a pivot, during commit attempt.
Hint: The transaction might succeed if retried.

Not sure what goes wrong in transaction B as I think that transaction A and B should work on each set and only lock sets where other_id equals 1 nad 2 reprectively. But it seems like the entire table is protected?

I have tested the same with "Repeatable Read" isolation level and which works perfectly. I can see that it should be "Phantom Read" that is allowed here.

Can someone shred some light on what goes on here as I expected it would work without any issues?

log_connections - showing the remote user

$
0
0
Hi

We would like to audit login attemts to the PG databasen, and have set the parameter

log_connections = on

It logs fine, showing the remote hostname where the login attempt originated.

But we would like to see the remote linux user name (who performed the login attempt. Ex. using "psql").

Is it possible ?

Best regards
Martin

Runtime 3073 with DoCmd.RunSQL

$
0
0
I am using the following code and keep getting this runtime error:

ssql = "update mytable set mycolumn = '11'"

docmd.runsql ssql


The error states that I must use an updatable query. I used the similar syntax to delete all rows from this table earlier in this routine with no problems.

Help..

RankFirstHosting.Com | High Quality Shared Hosting at Low Price | cPanel, Softaculous

$
0
0
Rankfirsthosting.com is a successful platform for finest SEO hosting. We provide you an outstanding yet budget friendly web hosting solution for your growing business. At Rankfirsthosting.com, we make it easier to get started with your business with just the thing that is required; a dependable and speedy web hosting package. Our hosting services are amazing and also our staff are here to assist you with your hosting requirements. We try hard to provide you with top level support to all our customers and would wish to provide you with our volume of care by hosting your websites.

At the moment we are offering following range of shared hosting deals.

DEAL ONE
10 IP Addresses
10 GB Disk Space
80 GB Bandwidth
Price: $15 per month
CLICK HERE TO ORDER DEAL ONE

DEAL TWO
20 IP Addresses
20 GB Disk Space
120 GB Bandwidth
Price: $30 per month
CLICK HERE TO ORDER DEAL TWO

DEAL THREE
30 IP Addresses
30 GB Disk Space
160 GB Bandwidth
Price: $45 per month
CLICK HERE TO ORDER DEAL THREE

DEAL FOUR
40 IP Addresses
40 GB Disk Space
200 GB Bandwidth
Price: $60 per month
CLICK HERE TO ORDER DEAL FOUR

DEAL FIVE
50 IP Addresses
50 GB Disk Space
240 GB Bandwidth
Price: $75 per month
CLICK HERE TO ORDER DEAL FIVE

DEAL SIX
60 IP Addresses
60 GB Disk Space
280 GB Bandwidth
Price: $90 per month
CLICK HERE TO ORDER DEAL SIX

DEAL SEVEN
70 IP Addresses
70 GB Disk Space
320 GB Bandwidth
Price: $99 per month
CLICK HERE TO ORDER DEAL SEVEN

DEAL EIGHT
80 IP Addresses
80 GB Disk Space
360 GB Bandwidth
Price: $100 per month
CLICK HERE TO ORDER DEAL EIGHT

DEAL NINE
90 IP Addresses
90 GB Disk Space
400 GB Bandwidth
Price: $112.50 per month
CLICK HERE TO ORDER DEAL NINE

DEAL TEN
100 IP Addresses
100 GB Disk Space
440 GB Bandwidth
Price: $125 per month
CLICK HERE TO ORDER DEAL TEN

DEAL ELEVEN
110 IP Addresses
110 GB Disk Space
480 GB Bandwidth
Price: $137.50 per month
CLICK HERE TO ORDER DEAL ELEVEN

DEAL TWELVE
120 IP Addresses
120 GB Disk Space
520 GB Bandwidth
Price: $150 per month
CLICK HERE TO ORDER DEAL TWELVE

DEAL THIRTEEN
130 IP Addresses
130 GB Disk Space
560 GB Bandwidth
Price: $162.50 per month
CLICK HERE TO ORDER DEAL THIRTEEN

DEAL FOURTEEN
140 IP Addresses
140 GB Disk Space
600 GB Bandwidth
Price: $175 per month
CLICK HERE TO ORDER DEAL FOURTEEN

DEAL FIFTEEN
150 IP Addresses
150 GB Disk Space
640 GB Bandwidth
Price: $187.50 per month
CLICK HERE TO ORDER DEAL FIFTEEN

DEAL SIXTEEN
160 IP Addresses
160 GB Disk Space
680 GB Bandwidth
Price: $160 per month
CLICK HERE TO ORDER DEAL SIXTEEN

DEAL SEVENTEEN
170 IP Addresses
170 GB Disk Space
720 GB Bandwidth
Price: $170 per month
CLICK HERE TO ORDER DEAL SEVENTEEN

DEAL EIGHTEEN
180 IP Addresses
180 GB Disk Space
760 GB Bandwidth
Price: $180 per month
CLICK HERE TO ORDER DEAL EIGHTEEN

DEAL NINETEEN
190 IP Addresses
190 GB Disk Space
800 GB Bandwidth
Price: $190 per month
CLICK HERE TO ORDER DEAL NINETEEN

DEAL TWENTY
200 IP Addresses
200 GB Disk Space
840 GB Bandwidth
Price: $200 per month
CLICK HERE TO ORDER DEAL TWENTY

Following are some of the features we provide:

PHP, Perl and Python
Support along with MySQL database access.

cPanel
Easily manage your server with cPanel and the Softaculous auto-installer.

PhpMyAdmin
To manage databases.

Ruby on Rails
Support using Passenger for enhanced performance and reliability.

FTP & sFTP
Access your server via FTP or secure FTP.

Cron jobs
For scheduled tasks.

ReCommerce ready
SSL encryption available.

Shell access
Jailed shell upon request.

Error pages
Customize it any way you like.

*** CONTACT INFO ***
Email: support[at]rankfirsthosting.com
Phone: +1 718 414 6543
Ticket: To submit a ticket CLICK HERE

DB2 HADR - gather archived logs to TSM

$
0
0
Hello all,

I am trying to set up HADR replication between two servers, which, by itself is pretty straightforward. But in my configuration, I would like to set up the archive log destination on primary to be TSM --> LOGARCHMETH1 = TSM

Will this work the same, as if the LOGARCHMETH1 would be set to somewhere on the local disk ( /db2/log_archives for example ) ?

I have found this on the web: http://www.ibm.com/support/knowledge.../c0020882.html

As I understand this note from IBM, the primary's archive logs are backed up to TSM and if the roles are switched between the primary and standby, the standby writes archive logs to TSM as well. My question is, has anyone tried to set up HADR in this regard ? Does it function fine, or are there any drawbacks to this type of setup regarding gaps in replication, performance issues or similar... ?

Thanks and best regards,
kwhtre

Access DCount giving Runtime 3078 error

$
0
0
Hi everyone,

I'm just learning how to use Access, so this might be quite a simple fix, although nothing I've found online has helped yet.

I'm to create some metadata held during a vba script (and then discarded) to be used for calculations which'll go in a table. The first (and simplest one) is meant to just be a count of the number of records in an input data table. Here is the relevant script I have so far:

Dim var_num As Integer
Set rec_source_data = db.OpenRecordset("select * from TBL_DATA_Combined order by ID_Number")
var_num = DCount("ID_Number", "rec_source_data")

Before I put in the DCount, the rest of the script was working fine, and to check that nothing else was tripping up the DCount, I positioned it right after the Set rec_source_data line. I've tried defining var_num as a double and single too (though it should of course be an integer), no luck, and initially the DCount was meant to be filtered, so it looked like this

var_num = DCount("ID_Number", "rec_source_data", "Filter = True")

Nothing I've found online suggests I have the wrong syntax, but whatever I do (including rebooting my laptop), I keep getting Run time error 3078 - that the db can't find the input table rec_source_data.

Any suggestions? Thanks in advance

Windows ODBC with keberos auth?

$
0
0
Hi all,

we use the oracle windows odbc driver (instant client 12.1) within a visual basic 6 application. The oracle database has keberos auth enabled and it works.
Does the odbc driver support keberos? I found a connection string that should work, but i doesn't:

Code:

Data Source=myOracleDB;User Id=/;

Is it possible to do a single signon against the oracle database, using the current windows keberos ticket and the odbc driver?


Best regards

Pete

need help with permission and login

$
0
0
There is the questions that i need to figure out, i am confused ,
Write a script to create a new login called ass8 (password is also ass8) as a member of
dbcreator server role in your SQL Server.

Set master as your active database and run an EXECUTE AS statement to switch from your
login to ass8 and Run CREATE DATABASE db_ass8.

Expand the Security folder of your server to find ass8 login. Double click to open ass8
property dialog. Select 'Server Roles' on the left panel. What server roles ass8 has?

Select 'User Mapping' on the left panel. Click on db_ass8 database. What user ass8 login
is now mapped to? What database roles this user has in db_ass8?
*/





/* Q2.
After Q1, write a script to switch back to your administrator login and remove ass8 from
dbcreator role but map it as ass8u user with a db_datareader role in the AP database.

With the membership of db_datareader, ass8u can access every table of AP. If it is decided
to let ass8u keep db_datareader membership but have no permission to read GLAccounts data,
what statement needs to execute for this purpose?
*/

Lookup from Multiple Columns without self join.

$
0
0
I have two tables:TabA


ID,ID2, Field1, Field2
1, 1, red, Honda
1, 2, blue, ford
2, 1, black, mustang

TabB
Value, Description
red, colur red
blue, colur blue
black, colur black
honda, makes cheap cars
ford, makes cars
mustang, american muscle


How can I get an output like so:

1 , 1, red color red, honda, makes cheap cars


I tried referencing TabB multiple times in my SQL, but the DBA says that if they run that in production, it would likely crash the system. That tables has millions of rows.

I'm only months into coding, so please help me out

Help with Query.

$
0
0
Hello, first of all I'm not a DBA and have limited knowledge. I'm currently managing CMDBuild server and need to create a new report, one that pulls out our devices make and model numbers, the thing is that when I create a query the Make Model output is displaying numbers, looks to me if the query is pulling the field ID rather than the field data. This is the query I'm running:
SELECT "StorageArray"."Code", "StorageArray"."MakeModel"
FROM "StorageArray"

"StorageArray"."Code" pulls the Serial numbers of the devices and "StorageArray"."MakeModel" supposed to pull the make and model of the devices, but its not. MakeModel is a lookup type, what am I doing wrong?

Thanks in advanced.

Update huge table with million of rows

$
0
0
Hi All,

I have a table with 150 million rows and need to update/insert in another similar structured table.

below is the update which needs to perform:

Update cord1_odometer_cur..asset_odometer_estimate_test
set est_odom_reading = b.est_odom_reading
, est_mos_in_svc=b.est_mos_in_svc
, est_bk_val=b.est_bk_val
, SPIN_audit_update_dt=getdate()
, est_basis_cd=b.est_basis_cd
from cord1_odometer_cur..asset_odometer_estimate_test a
INNER JOIN abc..asset_odometer_estimate_stg b
ON a.SPIN_asset_id=b.SPIN_asset_id
and a.est_odom_reading_dt=b.est_odom_reading_dt;

Stage table is not having any indexes as of now and _test table has unique index constraint on SPIN_ASSET_ID and est_odom_reading_dt.

Thanks,
Saurabh Goyanka

★ CHEAP ASP.NET MVC 6 HOSTING ★ $1/mo | Unlimited Domain | FREE MSSQL db

$
0
0


:: CHEAP ASP.NET MVC 6 HOSTING WITH ASPHOSTPORTAL.COM ::

Are you tired of endless downtimes? Long support response times? Poor speeds? You don't need to deal with these! You are paying your hard-earned money, why put up with sub-par services??!! Transfer over to ASPHostPortal Solutions and all these issue will go away.

With Min 1000 Mbps connection and our premium hardware, we will make sure your site never feel slow. When you make the switch to ASPHostPortal Solutions the transfer from your previous hosting provider is completely free of charge. We also give you everything you need and more to run your websites smoothly with a professional support team available 24/7 to assist you.

GET IT NOW !!!

=======================

With hundreds of web hosting companies out there, how can you decide which one is best for you?

Here are a few things that make ASPHostPortal differs from the rest.

>> We offer web hosting in 12 different locations. Washington, London, Paris, Frankfurt, Amsterdam, Melbourne, Toronto, Sao Paulo, Chennai, Milan, Hongkong and Singapore.
>> We have the fastest 1,000 Mbps connection backbone in all of our server, say goodbye to SLOW problems.
>> We will give you daily backup service, your data will be safe every time.
>> We offer Cheap Windows and Linux Dedicated Cloud Server Plans, for those who have outgrown shared hosting and want to manage their own server.
>> We have 24/7 support team to solve your issue. Every time we are ready for you.

Switching to us? We have a unique SLA promise if you unsatisfied with our service in first 30 days, we will give your money back.

=======================

:: OUR ASP.NET MVC 6 HOSTING PLAN FEATURES ::

Ready to switch your website for the very last time?

HOST INTRO - $1/month
1 GB Hard Drive Space
10 GB Bandwidth
One Domains
Perfect for: personal websites, small blogs

HOST ONE - $5/month
5 GB Hard Drive Space
60 GB Bandwidth
Unlimited Domains
Perfect for: personal websites, small blogs

HOST TWO - $9/month
15 GB Hard Drive Space
150 GB Bandwidth
Unlimited Domains
Perfect for: small business, forums, etc.

HOST THREE - $14/month
50 GB Hard Drive Space
500 GB Bandwidth
Unlimited Domains
Perfect for: busy blogs/forums/image sites

For Order please visit : http://asphostportal.com/ASPNET-Core-1-1-Hosting

=======================

:: ASPHOSTPORTAL SUPPORTED FEATURES ::

>> Support all version of ASP.NET Hosting
>> Support all version of ASP.NET MVC Hosting
>> Support WCF RIA, and all version of Silverlight 5 Hosting
>> Support all version of Visual Studio Hosting
>> Support FULL Trust Mode
>> Support all version of SQL Hosting
>> Support all version of Crystal Report Hosting
>> Support Visual Studio LightSwitch Hosting
>> Support Web Deploy and FTP
>> Support all version of SSRS Hosting
>> Other features such as Wordpress, Joomla, Umbraco, DotNetNuke, Orchard, Drupal, etc

=======================

:: ABOUT US ::

ASPHostPortal is a hosting company that best support in Windows and ASP.NET-based hosting. Services include shared hosting, reseller hosting, and SharePoint hosting, with specialty in ASP.NET, SQL Server, and architecting highly scalable solutions. As a leading small to mid-sized business web hosting provider, ASPHostPortal strive to offer the most technologically advanced hosting solutions available to all customers across the world. Security, reliability, and performance are at the core of hosting operations to ensure each site and/or application hosted is highly secured and performs at optimum level.

WHUK Site Scanner - Complete Web Vulnerability Detection & Protection | Free Trial

$
0
0
Leave all your worries about rising cross-site scripting attacks, vulnerabilities, malicious activities, code injections and many other types of threats to us. Now you can simply keep safe your website with our advanced WHUK Site Scanner proven technology to protect and secure your website against malwares, Trojans and vulnerabilities.

What is WHUK Site Scanner?
WHUK Site Scanner is a web application security scanner with the ability to detect vulnerabilities in a website and its code, which may lead to website data problems and security issues. WHUK Site Scanner is also capable of inspecting server settings, Trojans, Viruses, malware etc. and has various scanning options like SQL, LFI, RFI, MALWARE and INSTANT scan etc. WHUK Site Scanner also looks after your websites healthy reputation by checking whether it is blacklisted by Google, Real Time Black Hole List check (RBL), Clean MX, SURBL, Malware Patrol (Mpatrol), PhishTank and generates reports for the same.

WHUK Site Scanner Key Features:
  • Domain reputation in Google, SURBL, Malware Patrol, Clean-Mx, Phishtank
  • Mail server IP Check in 58 RBL repositories
  • Scan Malware / XSS (Cross Site Scripting) Attacks / SQL Injections / CMS
  • Scan Local file injections (LFI) / Scan Remote file inclusion (RFI)
  • Checks Open Ports
  • Scans for Full Path Disclosure
  • Reverse IP Domain Check
  • Detects Sensitive Admin Areas
  • Page Defacement Detection
  • Scans Authentication Areas
  • Directory Scanning
  • Checks SSL Certificates
  • Robust Link Crawler
  • Backdoor WebShell Locater (Client Side - Unique Feature)
  • Reverse IP domain check
  • WAF (Website Application Firewall) Detection
  • CSRF (Cross Site Request Forgery)
  • ClickJack Protection Check
  • DNS Misconfiguration
  • OS Detection


WHUK Site Scanner Packages:

Free
  • One Time Scan
  • Up to 5 Pages
  • Mail Server Blacklist Check
  • Domain Reputation Check
  • Malware and Vulnerability Detection
  • Full Website Scan
  • Security Checks
Monthly Price: FREE | Order Now

Basic @ £4.99/pm GBP Inc. VAT
  • Daily One Scan
  • Up to 50 Pages
  • Mail Server Blacklist Check
  • Domain Reputation Check
  • Malware and Vulnerability Detection
  • Full Website Scan
  • Security Checks
Monthly Price: £4.99/pm GBP Inc. VAT | Order Now

Standard @ £9.99/pm GBP Inc. VAT
  • Daily One Scan
  • Up to 100 Pages
  • Mail Server Blacklist Check
  • Domain Reputation Check
  • Malware and Vulnerability Detection
  • Full Website Scan
  • Security Checks
  • Page Content Monitoring
Monthly Price: £9.99/pm GBP Inc. VAT | Order Now

Advanced @ £19.99/pm GBP Inc. VAT
  • Daily One Scan
  • Up to 200 Pages
  • Mail Server Blacklist Check
  • Domain Reputation Check
  • Malware and Vulnerability Detection
  • Full Website Scan
  • Security Checks
  • Page Content Monitoring
Monthly Price: £19.99/pm GBP Inc. VAT | Order Now

For more details, visit WHUK's Malware Trojan Vulnerability Scanner for Websites

Quote:

Initiate a live chat with one of our friendly sales advisor to avail exclusive benefits!
About WHUK
WHUK, a web hosting company in the UK since 2001. The services come equipped with powerful features capable of serving wide range of requirements. Both, cloud and dedicated hosting packages are power packed and fully equipped with the best in-class features. With the infrastructural set-up housed at state-of-the-art Tier 4 Datacenter in the UK, you can expect the best uptime ever.

For any information with regards to festive discounts and offers, please contact our sales department by initiating a chat or by dropping an email to sales @ webhosting.uk.com or call us on 0800 862 0890 / +44-191-303-8069.

DLookup errors in Access VBA

$
0
0
Hi again,

I'm running into similar issues with DLookup as I was with DCount the other day. I have data I'm trying to extract from a data table. I've tried a variety of different syntax formats, but I keep getting either Run Time errors 2471 or 3464 whatever I try.. here's the relevant code:

Dim var_counter As Integer
Dim var_active_ID As Integer
Dim var_num As Integer

Set rec_source_data = db.OpenRecordset("select * from TBL_DATA_Combined order by ID_Number")

var_num = DCount("ID_Number", "TBL_DATA_Combined", "filter = True")
var_counter = rec_source_settings![f_assump_counter]
var_active_ID = var_counter - var_num + 2

var_salary = DLookup("Salary", "TBL_DATA_Combined", "ID_Number = ' " & var_active_ID & " ' ") 'I initially had the var_active_ID equation in the DLookup, but after the first error, I thought that might be a problem, so I broke up the steps

Everything I've tried, be it making it [Salary] and [ID_Number], "ID_Number = '" & var_active_ID & "'", "ID_Number = " & var_active_ID, or a half-dozen other possibilities mentioned online, nothing has worked.. I'm hoping someone on here has a solution to my conundrum again, as I seem to me making a habit of finding new ways to use Access..!

Thanks in advance :)

MS Access VBA Update with Aggregate Query

$
0
0
I have 2 tables as follows:

Table1
EmployeeID
MonthlyBonus

Table2
EmployeeID
DailyBonus

Where there is a single unique instance for each employee in Table1 and multiple instances for each employee in Table2.

I am trying to update Table1 with the Sum() of the DailyBonus for each employee from Table2.

I have tried a number of different SQL statements to do this to no avail. Does anyone happen to know the correct syntax?

Looping through specific controls in Access form

$
0
0
Hi

I have an access form called "Home". There are a number of 20 buttons with the name of MN001 to MN020. I would like to loop through all the buttons and compare them with a list in table and when matched i would like that button to be enabled otherwise it should be disabled.
Please any idea or help or samples.

Thanks in advance for any one

Help with database design

$
0
0
So I am currently doing a semester project for school, and I decided to do a video game store and design something around that.

The thing is I'm confused how I would go about this.

dbdesign.png

From the picture, you can see I rely on a primary key (inv_id) frequently with how I did it.

Is it wrong to have multiple tables with foreign keys referencing that primary key?

If so, what exactly could I do about it.

Thanks in advance.
Attached Images

Postgresql filtering a grouped view

$
0
0
I have a grouped view that I need to filter. My query is using the indexes correctly but the query plan gets some extra steps when I filter against a grouped view vs filtering the table directly and then grouping. Below is a stripped down example to show what's happening. Any way I can get the last query below to perform the same as the first? Postgresql 9.6
Code:

create temp table tbl(val int primary key);
insert into tbl select generate_series(1, 5000000);
create temp view vw as select val, count(*) cnt from tbl group by 1;
SELECT val, COUNT(*) cnt FROM tbl WHERE val IN (SELECT generate_series(1,10000)) GROUP BY val;
SELECT val, cnt FROM vw WHERE val IN (SELECT generate_series(1,10000));

Viewing all 13329 articles
Browse latest View live