Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

insert into select failing and read only tables

Status
Not open for further replies.

Inandjo

Programmer
Dec 7, 2001
46
FR


SQL SQL SQL SQL

hi,
i have 2 problems here.

1)
i have 2 tables:

currency rates
+---------------------+ +--------------------+
| code char(3) | | currency char(3) |
| name varchar(10) | | rate double |
| bcurrency char(1 ) | | ryear varchar(4) |
| | | rmonth varchar(10) |
+---------------------+ +--------------------+

I'm have a form, from which i pick 2 value "2000" and "february".
I'm trying to insert fields form currency to rates, matching
particular conditions in order to avoid data duplication.
The rate table basically has the exchange rate for a particular
currency in a particular year and a particular month.
The trio currency,ryear,rmonth SHOULD be unique.

My query is the following:

insert into rates (currency,ryear,rmonth)
select a.code, "2000", "february" from currency a, rates b
where a.bcurrency=&quot;N&quot; and a.code<>b.currency and
b.ryear=&quot;2000&quot; and b.rmonth=&quot;february&quot;


The error message i get is: &quot;INSERT TABLE 'rates' isn't allowed
in FROM table list&quot;.
How can i solve this problem??

PS:This query works well when i don't add the condition after the first
condition in the where clause.


2)
i have a &quot;read only table!&quot; error message when i try to execute a &quot;insert
into ...select&quot;
from a program.
How can i check this status of the table??
Is there a command to tell me which table is read only at a particular time?




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top