|
Blue_Boy wrote: Did you mean get all column name list of current table.
yes
|
|
|
|
|
Hmm CDatabase looks like a wrapper class around a connection - a C++ one at that!
It will depend on your database and your permissions but in sql server there are the system information views and the sysobjects table. These will supply all the system information you need. This may be useful System view mapping[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Why I am getting the following error for Functions?
1548 cannot load from mysql.proc. The table is probably corrupted
Thanks,
jassim
|
|
|
|
|
|
I did that and I restarted the server to make sure the services were restarted but I am still facing the same problem.
|
|
|
|
|
DECLARE
cursor c1 is select * from dept;
cursor c2 is select * from emp;
s emp.sal % type;
BEGIN
for i in c1
s:=0;
dbms_output.put_line(‘
dbms_output.put_line(‘Department is:’║ i.deptno║’Department name is:’║i.dname);
dbms_output.put_line(‘
for j in c2
if(i.deptno=j.deptno)then
s:=s+j.sal;
dbms_output.put_line(j.empno║ ‘ ‘║j.ename ║’ ‘║j.sal);
end if;
end loop;
dbms_output.put_line(‘
dbms_output.put_line (‘Total salary is:’║s);
dbms_output.put_line(‘
end loop;
END;
Please help i need solution ASAP ty
|
|
|
|
|
Well, what's the problem?
|
|
|
|
|
This is the error
ERROR at line 7:
ORA-06550: line 7, column 7:
PLS-00103: Encountered the symbol "S" when expecting one of the following:
. ( * @ % & - + / at loop mod remainder rem ..
<an exponent (**)> || multiset
The symbol "loop" was substituted for "S" to continue.
ORA-06550: line 8, column 27:
PLS-00103: Encountered the symbol "`" when expecting one of the following:
( ) - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max min pr
ORA-06550: line 9, column 24:
PLS-00103: Encountered the symbol "`" when expecting one of the following:
( ) - + case mod new not null select <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max
|
|
|
|
|
I have no idea what language that is, but perhaps you shouldn't be using the ` character. As for S on line 7, you're on your own.
|
|
|
|
|
It looks like PL-SQL to me.
|
|
|
|
|
Yes, but embedded in something Pascal-like? I haven't done PRO*C for more than ten years.
|
|
|
|
|
Well, that's PL/SQL, it's meant to look like ADA or Pascal.
PL/SQL != Pro*C
|
|
|
|
|
|
It looks like you're missing the keyword loop after for i in c1 and after for j in c2
Try this:
DECLARE
cursor c1 is select * from dept;
cursor c2 is select * from emp;
s emp.sal % type;
BEGIN
for i in c1
loop
s:=0;
dbms_output.put_line(‘
dbms_output.put_line(‘Department is:’║ i.deptno║’Department name is:’║i.dname);
dbms_output.put_line(‘
for j in c2
loop
if(i.deptno=j.deptno)then
s:=s+j.sal;
dbms_output.put_line(j.empno║ ‘ ‘║j.ename ║’ ‘║j.sal);
end if;
end loop;
dbms_output.put_line(‘
dbms_output.put_line (‘Total salary is:’║s);
dbms_output.put_line(‘
end loop;
END;
/
|
|
|
|
|
I have got a problem with modifing the tables of MDF because the LDF file cannot make a corresponding changes.
I used SQL2000 manager to ouput a table of mydata(game database) to a xls file. Then I used Excel to make changes to it, since Excel is easy to manage a great number of entries. After having finished that, I converted xls file back to the table in mydata. Something went wrong, cuz I hadn't update the corresponding LDF file.
Could someone give a solution? many thanks.
|
|
|
|
|
NEVER trust Excel to handle data output.
Reports are okay, but Microsoft knows all and since you really do not want that 16 digit account number to be text, they make it scientific notation dropping the last few digits in the process. That leading zero is defanintly not needed. 1.1 well that should really be 1.10000000102.
These are NOT a rant they are fact (except the value shown for the decimal).
Get a good text editor. I believe NotePad++ will do it and there are several pay to use packages that say they handle large files (I use VEDIT).
|
|
|
|
|
Just wondering how you converted an xls file "back to the table in mydata"?
|
|
|
|
|
I have two tables like this
Sales table Purchases table
--------------------- ------------------------------
SaleDateTime | Cost PurchaseDateTime | Cost
--------------------- ------------------------------
02-09-11 | 35 02-09-11 | 48
03-09-11 | 35 02-09-11 | 48
06-09-11 | 35 04-09-11 | 48
07-09-11 | 35 05-09-11 | 48
08-09-11 | 35 08-09-11 | 48
I want to produce result like this
Date | Sale_total | purchase_total
--------------------------------------------
02-09-11 | 35 | 96
03-09-11 | 35 | 0
04-09-11 | 0 | 48
05-09-11 | 0 | 48
06-09-11 | 35 | 0
07-09-11 | 35 | 0
08-09-11 | 35 | 48
how can I do this ?
Additional info:-
I am using MS Access.
---------------------------------------------
" Future Lies in Present "Manmohan Bishnoi
|
|
|
|
|
You can divide this task into three parts. The first part uses inner join to find the records from both tables with common date/time. The second part deals with the case that date/time only appears in the first table. The third part deals with the case that date/time only appears in the second table. The result is a union of the above three queries.
To show you what I mean in a cleaner example, let's suppose the first table is called "Table1" with the following two fields: a1 and a2 (corresponding to your "Sales" table's SaleDateTime and Cost columns), and the second table is called "Table2" with the following two fields: a1 and a2 (corresponding to your "Purchase" table's PurchaseDateTime and Cost columns). The following query should give you what you wanted.
SELECT a.a1, sum(a.aa2), sum(b.aa2)
FROM (SELECT a1, sum(a2) as aa2 FROM Table1 GROUP BY a1) as a,
(SELECT a1, sum(a2) as aa2 FROM Table2 GROUP BY a1) as b
WHERE (a.a1=b.a1)
GROUP BY a.a1;
UNION
SELECT a1, sum(a2), 0
FROM Table1
WHERE a1 not in (SELECT a1 FROM Table2)
GROUP BY a1
UNION
SELECT a1, 0, sum(a2)
FROM Table2
WHERE a1 not in (SELECT a1 FROM Table1)
GROUP BY a1
|
|
|
|
|
It is difficult to join datetime fields because of the time portion.
What appears as 09-10-11 may actually be stored as 09-10-11:09:30.00.00 in one field and 09-10-11:12:49.46.50 in another. So when you look at the date portion you would think they're the same value but they're not because of the time portion.
|
|
|
|
|
Actually I modified the fields
SaleDateTime and PurchaseDateTime. These fields contain only date values like 09-11-2011.
---------------------------------------------
" Future Lies in Present "Manmohan Bishnoi
|
|
|
|
|
You may have changed the display, that doesn't change the actual date value which still includes the time portion. So the date may display as 09-11-2011 but the real value may be 09/11/2011 08:30:20:15.
Anyway, try joining using those fields and see what you get.
|
|
|
|
|
yes you were right.
I had to change actual data of those fields.
thanks
---------------------------------------------
" Future Lies in Present "Manmohan Bishnoi
|
|
|
|
|
hi,
how to publish sql server database in server.
thanks in advance!
Have A Nice Day!
Murali.M
Blog
|
|
|
|
|
What do you mean by "publish"?
The data from a SQL Server database can be replicated many ways (backup/restore, detach/attach, ...). You need to have a SQL Server accessible by the client.
If you mean publish as with a .NET program that is a different problem.
|
|
|
|