|
I'm new in the database world...
I want to know if its possible to add image ( simple bitmap or jpeg ) to the database ?
If this is possible => how can i get and set the image from C# code ?
Thanks for the help.
|
|
|
|
|
Hi,
There is an "image" data type in SQL Server which is basically a binary datatype. http://msdn.microsoft.com/en-us/library/ms187993.aspx[^]
Storing binary inside a database is generally strongly advised against though. Before you do that you might want to check if using the filesystem could be a better solution.
|
|
|
|
|
Yes you can insert image or retrieve it from your Database by using BLOB(binary Large object) approach in which an image file is convert into Binary data which is compatible to store data in Database.
Google has a lots of resource for this purpose. whatever i suggest you to move for this given link
Save An Image Into SQL Server 2000 Database[^]
|
|
|
|
|
Tony Pottier wrote: Storing binary inside a database is generally strongly advised against though
I disagree on the "generally strongly" advice.
Manageability, consistency, security, reliability, portability are all reasons for storing binaries in the database.
Storing binaries in the database means that you have db-enforced referential integrity, one point of entry for the backup, one place to set security...
"When did ignorance become a point of view" - Dilbert
|
|
|
|
|
you can also download the given sample code to learn how to store and retrieve image from SQL server.
Click on the given link to Download
Click me[^]
|
|
|
|
|
I do every day differential backup, transaction log and shrink file, weekly full backup.when i restore database, it show this message:
Processed 6536 pages for database 'project2', file 'project2' on file 1.
Processed 2 pages for database 'project2', file 'project2_log' on file 1.
RESTORE DATABASE successfully processed 6538 pages in 12.534 seconds (4.273 MB/sec).
Processed 0 pages for database 'project2', file 'project2' on file 1.
Processed 4 pages for database 'project2', file 'project2_log' on file 1.
RESTORE LOG successfully processed 4 pages in 0.048 seconds (0.544 MB/sec).
Msg 4312, Level 16, State 1, Line 3
This log cannot be restored because a gap in the log chain was created. Use more recent data backups to bridge the gap.
Msg 3013, Level 16, State 1, Line 3
RESTORE LOG is terminating abnormally.
Msg 4312, Level 16, State 1, Line 4
This log cannot be restored because a gap in the log chain was created. Use more recent data backups to bridge the gap.
Msg 3013, Level 16, State 1, Line 4
RESTORE LOG is terminating abnormally.
Msg 3136, Level 16, State 1, Line 5
This differential backup cannot be restored because the database has not been restored to the correct earlier state.
Msg 3013, Level 16, State 1, Line 5
RESTORE DATABASE is terminating abnormally.
how can i solve this problem.
|
|
|
|
|
First do not shrink the file.
|
|
|
|
|
anyone knows where can I find the Lite Edition of EMS SQL for PostgreSQL? I am unable to fine the download link!
Thanks
|
|
|
|
|
http://www.sqlmanager.net/products/postgresql/manager
|
|
|
|
|
why this code returns all rows although I specified the condition? how to correct?
CREATE OR REPLACE FUNCTION fn_get_resume_details2(resume_id integer)
RETURNS SETOF record AS
$$select resume_id, resume_title, objective_title, objective_text, summary_title, summary_text from resume_details where resume_id = resume_id;
$$LANGUAGE sql;
</pre>
|
|
|
|
|
In your where clause, resume_id = resume_id, that is the same as saying where 1 = 1. It will be true for all rows. I'd recommend changing the name of your parameter to be different from the column name.
CREATE OR REPLACE FUNCTION fn_get_resume_details2(in_resume_id integer)
RETURNS SETOF record AS
$$select resume_id
,resume_title
,objective_title
,objective_text
,summary_title
,summary_text
from resume_details
where resume_id = in_resume_id;
$$LANGUAGE sql;
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
why I am getting the above error when trying to run this code with PostgreSQL on C# .NET application? how can I fix it?
CREATE OR REPLACE FUNCTION fn_get_resume_details2(resume_id integer)
RETURNS SETOF record AS
$$select resume_id, resume_title, objective_title, objective_text, summary_title, summary_text from resume_details where resume_id = resume_id;
$$LANGUAGE sql;
</pre>
<div class="signature">
<div class="modified">modified on Monday, November 1, 2010 9:55 AM</div></div>
|
|
|
|
|
Please do not post the same message in multiple forums; choose one and stick to it. You have been a CP member long enough to know the protocol.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I have a clinic management software on C# WinForm and planning to have an online interface for eServices. I am planning to move from SQL Server because of the cost and the Express Edition is not enough capacity..
So for such project, if you are the decision make then which database you'll move to? PostgreSQL or MySQL? or maybe another FREE db?
|
|
|
|
|
You asked that some 8 weeks ago, and got plenty of answers.
|
|
|
|
|
My Preference goes to PostgreSQL.
|
|
|
|
|
I'm trying to use C# to add a column to an MS Access database, but I'm having trouble with the syntax.
My SQL string amounts to something like this:
ALTER TABLE t_customer <br />
ADD person_id integer <br />
CONSTRAINT FK_person_id <br />
FOREIGN KEY (person_id) <br />
REFERENCES t_person (person_id)
I can't find any difference to the MSDN example syntax.
Can you tell me where the error is?
Thanks!
|
|
|
|
|
Megidolaon wrote: My SQL string amounts to something like this
"Something like that" should work.
Megidolaon wrote: Can you tell me where the error is?
Not without seeing your code, but I could do an educated guess. You're referring to this[^] example? The example on that page lists this code;
dbs.Execute "ALTER TABLE Orders " _
& "ADD CONSTRAINT OrdersRelationship " _
& "FOREIGN KEY (EmployeeID) " _
& "REFERENCES Employees (EmployeeID);"
Are you concatenating strings the same way? If so, check the resulting string - it may be missing the space at the end of each line; between "Orders" and "ADD", between "OrdersRelationShip" and "FOREIGN" and between ")" and "REFERENCES".
I are Troll
|
|
|
|
|
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...
|
|
|
|
|
Not sure the purpose of the child tables. You also need a rule for when an update occurs on the master table since you are replicating data in two tables.
Why not only have the master table with single inserts and create views on the master table that have the hard coded date ranges built into the views?
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
|
|
|
|
|
Thank you for your quick reply Chris.
I would be having around 5 million records per month in my table. That is why I thought of partitioning the table on the basis of months to generate month-wise reports. May be I got it wrong, but my understanding was that the data would be inserted only in the child tables and not the master table.
Due to the amount of data, the query being fired takes 4-5 mins to return any results (basically it is using the WITH RECURSIVE clause). I used indexes and also tried optimizing the query but it hardly made any difference. I might have to write the query in a different manner, but the problem is still with the amount of data in the table.
Kindly suggest on how to resolve this issue.
Thank you in advance.
|
|
|
|
|
hello all,
is it possible to load data from csv file into an oracle table using an ODBC bulk command ? 
|
|
|
|
|
why don't you use Sqlldr.exe for Bulk insert
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Because I am coding an application in VB6, I have only an ODBC link to the database
|
|
|
|
|
hatemtaleb wrote: Because I am coding an application in VB6
I'm not trying to be rude, but why are you coding in a dead and unsupported language.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|