Click here to Skip to main content
15,891,431 members
Home / Discussions / Database
   

Database

 
QuestionMessage Removed Pin
31-Oct-10 19:47
MahaKh31-Oct-10 19:47 
AnswerRe: How to connect VC++6 to sql server Repost Pin
Richard MacCutchan31-Oct-10 22:15
mveRichard MacCutchan31-Oct-10 22:15 
QuestionPostgreSQL or MySQL if not SQL Server? Pin
Jassim Rahma31-Oct-10 3:55
Jassim Rahma31-Oct-10 3:55 
AnswerRe: PostgreSQL or MySQL if not SQL Server? Pin
Bernhard Hiller2-Nov-10 0:51
Bernhard Hiller2-Nov-10 0:51 
AnswerRe: PostgreSQL or MySQL if not SQL Server? Pin
TweakBird8-Nov-10 1:09
TweakBird8-Nov-10 1:09 
Questionsyntax error in CONSTRAINT clause Pin
Megidolaon29-Oct-10 9:59
Megidolaon29-Oct-10 9:59 
AnswerRe: syntax error in CONSTRAINT clause Pin
Eddy Vluggen30-Oct-10 23:56
professionalEddy Vluggen30-Oct-10 23:56 
QuestionProblem while Inserting data in Postgres Partitioned table Pin
HalluSin8R29-Oct-10 4:16
HalluSin8R29-Oct-10 4:16 
CREATE TABLE nlma.acc_monthly_closing_details
(
str_voucher_code character varying(70) NOT NULL,
int_transaction_no integer NOT NULL,
str_voucher_no character varying(50) NOT NULL,
dt_voucher_date timestamp without time zone NOT NULL,
int_payable_id integer NOT NULL,
num_amount double precision NOT NULL DEFAULT 0,
char_cash_chq_auth character varying(1) NOT NULL,
char_credit_debit character varying(1) NOT NULL,

CONSTRAINT pk_monthly_closing_details_vcode_tranno PRIMARY KEY (str_voucher_code, int_transaction_no)
)
WITH (
OIDS=FALSE
);



CREATE OR REPLACE RULE insert_into_acc_monthly_closing_details_2010_01 AS
ON INSERT TO nlma.acc_monthly_closing_details
WHERE new.dt_voucher_date >= '2010-01-01'::date AND new.dt_voucher_date <= '2010-01-31'::date
DO INSTEAD INSERT INTO nlma.acc_monthly_closing_details_2010_01 (str_voucher_code, int_transaction_no, str_voucher_no, dt_voucher_date, int_payable_id, num_amount, char_cash_chq_auth, str_chq_no, dt_chq_date, char_credit_debit)
VALUES (new.str_voucher_code, new.int_transaction_no, new.str_voucher_no, new.dt_voucher_date, new.int_payable_id, new.num_amount, new.char_cash_chq_auth, new.str_chq_no, new.dt_chq_date, new.char_credit_debit);



CREATE TABLE nlma.acc_monthly_closing_details_2010_01
(
CONSTRAINT acc_monthly_closing_details_2010_01_dt_voucher_date_check CHECK (dt_voucher_date >= '2010-01-01'::date AND dt_voucher_date <= '2010-01-31'::date)
)
INHERITS (nlma.acc_monthly_closing_details)
WITH (
OIDS=FALSE
);

CREATE INDEX acc_monthly_closing_details_2010_01_dt_voucher_date
ON nlma.acc_monthly_closing_details_2010_01
USING btree
(dt_voucher_date);

the same way i have another 11 child tables, when i want to insert data using

INSERT INTO nlma.acc_monthly_closing_details
SELECT
a.str_voucher_code, b.int_transaction_no, a.str_voucher_no,a.dt_voucher_date,
a.int_payable_id,b.num_amount,a.char_cash_chq_auth,a.str_chq_no,
a.dt_chq_date, b.char_credit_debit,
FROM

nlma.acc_voucher_master a, nlma.acc_voucher_details b

WHERE

a.int_voucher_month=int_month and a.int_voucher_year=int_year and a.str_voucher_code=b.str_voucher_code;


It will Insert in Both Master as well as one child table.
IF any mistake in above code.. Please mention...
AnswerRe: Problem while Inserting data in Postgres Partitioned table Pin
Chris Meech29-Oct-10 5:55
Chris Meech29-Oct-10 5:55 
GeneralRe: Problem while Inserting data in Postgres Partitioned table Pin
HalluSin8R31-Oct-10 18:21
HalluSin8R31-Oct-10 18:21 
QuestionBULK INSERT using oracle ODBC driver Pin
hatemtaleb29-Oct-10 2:39
hatemtaleb29-Oct-10 2:39 
AnswerRe: BULK INSERT using oracle ODBC driver Pin
Rajesh Anuhya29-Oct-10 3:06
professionalRajesh Anuhya29-Oct-10 3:06 
GeneralRe: BULK INSERT using oracle ODBC driver Pin
hatemtaleb29-Oct-10 6:22
hatemtaleb29-Oct-10 6:22 
GeneralRe: BULK INSERT using oracle ODBC driver Pin
Mycroft Holmes29-Oct-10 12:40
professionalMycroft Holmes29-Oct-10 12:40 
GeneralRe: BULK INSERT using oracle ODBC driver Pin
Rajesh Anuhya29-Oct-10 18:57
professionalRajesh Anuhya29-Oct-10 18:57 
AnswerRe: BULK INSERT using oracle ODBC driver Pin
Rajesh Anuhya29-Oct-10 18:51
professionalRajesh Anuhya29-Oct-10 18:51 
Questioninsert and update Pin
future383929-Oct-10 0:02
future383929-Oct-10 0:02 
AnswerRe: insert and update Pin
Rajesh Anuhya29-Oct-10 0:15
professionalRajesh Anuhya29-Oct-10 0:15 
GeneralRe: insert and update Pin
future383929-Oct-10 0:22
future383929-Oct-10 0:22 
AnswerRe: insert and update Pin
Mycroft Holmes29-Oct-10 0:35
professionalMycroft Holmes29-Oct-10 0:35 
GeneralRe: insert and update Pin
future383929-Oct-10 3:01
future383929-Oct-10 3:01 
GeneralRe: insert and update Pin
Mycroft Holmes29-Oct-10 12:38
professionalMycroft Holmes29-Oct-10 12:38 
AnswerRe: insert and update Pin
Rajesh Anuhya29-Oct-10 3:08
professionalRajesh Anuhya29-Oct-10 3:08 
GeneralRe: insert and update Pin
future383929-Oct-10 3:15
future383929-Oct-10 3:15 
GeneralRe: insert and update Pin
future383929-Oct-10 3:25
future383929-Oct-10 3:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.