|
It doesn't matter how long your number is, you need the same number of zeros as you want to round to. For example, if you want to round to 4 decimal places you use .00005, to round to 3 decimal places you use .0005
Hope this clarifies.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks for the clarification.
Sasmi
|
|
|
|
|
Hi all,
I want to write a store proc that queries across db, and whenever I am at one db location, i want to query for a list of records which I want to store because I am going to perform an update on each of these based on the results that i gather earlier. once im done, ill loop and move on the next db.
Looks something like this;
1. Retrieve all db links
2. Loop to go to the first db link provided
3. Query table @current db link and use cursor to store the results
4. Loop results to perform update
5. Once, done go back to (2) and move to the next db until there is no more left
Now the question is, how to I access query across db dynamically? Currently i am using EXECUTE IMMEDIATE method. Next, can i use crusor when using execute immediate?
Any advice? Greatly appreciate it
Regards, Jensen
|
|
|
|
|
You can either use DBMS_SQL package to define and use the cursor or simply use REF CURSOR.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi,
How can i get a column sum by checking similar rows in database.I know its simple,but pls help me.
thanks
|
|
|
|
|
select sum(mark1) from table1 group by roll_no having roll_no=10
I think this will help u.
|
|
|
|
|
Thank u but the problem is i need to sm up the values depending on a flag
ie if flag is set then add or else substract.
|
|
|
|
|
Try something like this
create table #b1(usr sysname, flag char(1), val float)
insert into #b1(usr,flag,val) select 'a','n',22
insert into #b1(usr,flag,val) select 'b','Y',22
insert into #b1(usr,flag,val) select 'a','n',11
insert into #b1(usr,flag,val) select 'b','n',2
insert into #b1(usr,flag,val) select 'a','Y',100
select usr,sum(case when flag = 'y' then val else val * -1 end) from #b1 group by usr
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi friends
I have two table , name of the table is Table1, table2
table1 values
**************
rollno name tot
1 a 100
2 b 75
3 c 76
table2 values
*************
rollno reference_name
1 SSSS
1 RRRR
2 MMMM
i written the query like this
select table1.rallno,table1.mark,table2.refrence_name from table1 left join table2 on table1.rallno=table2.rallno
I want all the vale from Table1 and Table2 Roll No 1 has more reference name but I want only 1 Reference name
How can i write the query plz tell
|
|
|
|
|
If I understood you correctly, you're having a problem with the query because, based on your sample material, it returns 4 rows instead of 3.
If this is correct, you should use for example GROUP BY clause, but then you cannot have individual values from table2, only aggregates. So you should choose what do you want from table2. For example:
select table1.rallno,
table1.mark,
max(table2.refrence_name)
from table1 left join table2 on table1.rallno=table2.rallno
group by table1.rallno,
table1.mark
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi, a newbie to asp.
I have the following code which when run complains with error 'expected end of statement.'
What it is suppose to do is read in the ip address of a remote host and then do a comparison to an ip field within the database. It should also time stamp this entry if logic permits.
]]>
Would appreciate some help from anyone of you gurus of asp,sql out there.
Regards Phil.
|
|
|
|
|
please provide me with a link for studying all concept and features of a datatable
|
|
|
|
|
|
Very comprehensive link!
Should cover all the areas specified.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi all ;
I have two tables Table1 and Table 2 (I work with sqlserver 2005)
Table 1:
champ1---- champ2 ---- champ3
10 ---------- 14---- aaa
10 ---------- bbb----- 15
10 ----------- 13---- ccc
Table2
champ1 ------- champ4 -------- champ5
10 -------------wpm -------------- 1000
10 -------------- xcv -------------- 1200
I try to have the following results:
field1 ------ yyyy------ bbb -----cccc ------ wpm------ xcv
10----------- 14------------ 15 ------ 13-------- 1000 ----- 1200
I made half with pivot table:
field1 yyyy ------ ------ ----- bbb cccc
10----------- --- 14--------- 15 ------ 13 --
but I do not know how to add two columns wpm and xcv
help me thank you.
|
|
|
|
|
Without seeing the query you have already built, answering the question is quite difficult, so what's your query like?
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
i have to use MySQL Database as beckend for asp.net 2.0 web application can any body guide me basics of MYSQL dataabse Desgin . any article or help is highly apperciated .
Best reagrds
Rameez
|
|
|
|
|
Database design is a huge subject, regardless of the server used. Try Google, there are many, many articles and books that will help you.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
mysql provides u wid very friendly and easy to use interface.If u have ever logged in u might feel it right. Try creating a new database in it and then u can create tables and other stuff u want inside ur database. Using mysql is more like using IE.
well but the connection string is a bit lenghty.U use a odbc data provider for mysql.
connection string is:
"Driver =MYSQL ODBC <version> Driver ; Server= <servername> ; port=<port>;
option= 16387; Database=<database>; uid=<userid>;
Pwd=<password>;"
|
|
|
|
|
The relation databases should change the existing structure to tree like structures so that items of a sub item should be clearly represented
|
|
|
|
|
Ummm, well and what is the question?
Regards
Sebastian
|
|
|
|
|
If I understood correctly, you want to create a recursion on a single table. For example like in Person table it could have a reference to boss. Something like:
CREATE TABLE Person (
PersonID int,
Name varchar(50)
BossID int REFERENCES Person (PersonID)
)
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I've got to give you 5 for interpretation alone, I wonder of that is actually whet the Op was after, I have no idea what was being asked.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks, it was a guess based on few keywords like tree and sub item, but let's see. The answer may be off-topic.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I guess it's the elephant, right?
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|