|
In PLSQL Developer, try adding theses different where clauses and see if a TABLE ACCESS FULL still shows up.
where 1 = 1
or
where nvl(field,field) = field
The last one has the the field you are selecting in the where clause and may force the use of the index.
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]
|
|
|
|
|
Explain Plan with - where field <> 'imposibleValue'
SELECT STATEMENT.GOAL=FIRST_ROWS
SORT UNIQUE NOSORT
INDEX FULL SCAN
and the cost has reduced from 22,089 to 344
However, it only helps my understanding, not the problem!
|
|
|
|
|
It's always good to be able to understand a problem. At least now you have really good evidence to provide to the 3rd party vendor with a request for a change. Whether it is accepted or not is unfortunately an entirely different situation. Good luck with it though.
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]
|
|
|
|
|
You are right - adding a 'null' where clause such as where field <> 'imposibleValue' reduces the execution time from 1 minute to 1 second, so that is obviously forcing the use of an index.
Shame I can't change the sql
|
|
|
|
|
Wow! This thread just tought me that I had really good luck when I designed the generation of the sql queries in our application: I do often start the WHERE clause with a "WHERE (1=1) " so that I can add further conditions simply with " AND " (instead of checking if the WHERE clause is still empty or not) - I did so because of that laziness...
|
|
|
|
|
See, it pays off to be lazy sometimes.
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]
|
|
|
|
|
Hello everyone,
I have used sql2000 but sql2005 is also installed. I have created a select query that select the data opening a xml. while executing this query it generates an error:
Procedure sp_xml_preparedocument,
Failed to load Msxml2.dll.
please help me.
thank you in advance.
|
|
|
|
|
|
I have installed the msxml2.dll, but the problem is still there.
I have downloaded the file msxml2.dll.
Where should i store that file on computer, and how do we register that dll.
|
|
|
|
|
kaasir_2 wrote: Where should i store that file on computer
C:\Windows\System32
kaasir_2 wrote: and how do we register that dll.
regsvr32 C:\Windows\System32\msxml2.dll
I are Troll
|
|
|
|
|
I am using windows 7, while i try to register the msxml2.dll.
It can not register the msxml2.dll rather is throws an error:
(The module "c:\windows\System32\msxml2.dll"
failed to load
Make sure the binary is stored at the specified path or debug it to check for problems with the binary or dependent .dll files
A dynamic link library (dll) initialization routine failed.)
|
|
|
|
|
kaasir_2 wrote: I am using windows 7
You were logged in as an administrator while registering the library?
This[^] kb-article suggests that it might be caused by the wrong MDAC version, an update is available here[^]. That update should also replace the MSXML2.DLL library, without the need to register it by hand.
Hope this helps
I are Troll
|
|
|
|
|
|
Hey guys, I've got 4 tables
Table A
ID
B_ID
Table B
ID
Name
C_ID
D_ID
Table C
ID
Name
Table D
ID
Name
Now I want to make this selection:
Select A.ID, B.Name, C.Name, D.Name
Getting B.Name is simple by using a inner join but I', confused about how to get C.Name and D.Name based on B.ID (If the selection was one record It would be easier but sometimes it's multi-records)
regards,
|
|
|
|
|
Im not exactely sure what your issue is
getting C.Name and D.Name should be easy, but thats a seperate problem from your suggestion
mrkeivan wrote: but sometimes it's multi-records which implies that you may be looking for distinct rows - the data is what the data is - if you get multiple rows and you only want single rows, then you could have a fundamental constraint issue in your database design, or you're going to have to use distinct/unique keywords and hope its what you need
why dont you post the sql you think you'd use - its also not obvious to the rest of us wether the relationship between the tables are 1:1 or 1:m for example...
'g'
|
|
|
|
|
Me thinks you need to do some reading on sql queries, this is a very simple problem.
A is linked to B via BID
B is linked to C via CID
B is linked to D via DID
So do the joins and select your fields.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
you gave him the answer - I was going to make him work for it, then again, Ive been at work on a long weekend so Im a grumpy b@stard today (my team would say Im a grumpy b@stard everyday, but thats different )
I was more interested in his multiple rows issues - I tend to find bad database design everywhere, forcing people to use distinct, max, min etc to get unique rows when it could have been prevented (and its a pet hate of mine if someone doesnt know why they are using such a qualifier)
'g'
|
|
|
|
|
Garth J Lancaster wrote: Ive been at work on a long weekend so Im a grumpy b@stard today
So at least your getting paid to faff around with code today, I'm just bored at the moment.
Garth J Lancaster wrote: you gave him the answer
The answer, yes, the code not a chance. He still needs to do some reseach into the exact syntax. Desperately needs to do some study if this has stumped him.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Let me clarify what I just said,
using a simple select I get BID,
Select BID FROM A WHERE ID = x
If I was sure I had one record returned I would write a function to do the job but most of the time I get more than one BID, No for each BID I get I have to Fetch C.Name ON B.ID = C.B_ID
I Can't use inner join cause I have to have all the Fkeys in the main table A.
regards,
|
|
|
|
|
I still don't quite understand your problem, I must be missing something.
You select B_ID from A.
Then you use this to join to B to get all matching C_ID and D_ID values.
Then you use these to join to C to get C.Name and to D to get D.Name.
If there will be any missing rows or null values anywhere along the line, use an outer join instead of an inner join.
You can do all of this in one single SELECT statement. No need for functions, no need for FETCH or cursors or anything like that. If there are any N:M relationships along the chain, you may end up with more than one row for any given value of A.ID value. By using outer joins, you can ensure that you get at least one row for every A.ID value.
I think I must be missing something in your problem because it seems quite straightforward to me.
|
|
|
|
|
Try a left or right join for which ever table has the multiple.
|
|
|
|
|
Try this
Select a.Id, x.BName, x.CName,x.DName
From TableA a
Join(
Select
b.B_Id
,BName = b.Name
,CName = c.Name
,DName = d.Name
From TableB b
Join TableC c On b.C_Id = c.C_Id
Join TableD d On b.D_Id = d.D_Id)x
On a.B_Id = x.B_Id
Hope this helps
Niladri Biswas
|
|
|
|
|
Hi all,
I just ran some code to create a database and a table within it. I then try to open it within the same program using the same connection string and get an exception:
You are trying to access an older version of a SQL Server Compact Edition database.
If this is a SQL Server CE 1.0 or 2.0 database, run upgrade.exe.
If this is a SQL Server Compact Edition 3.0 or later database, run Compact / Repair.
[ Db version = 3505053,Requested version = 3004180,File name = XXXX ]
How can I be running a program that creates a database using a different version of SQL CE?
modified on Friday, June 11, 2010 9:05 AM
|
|
|
|
|
Hello All ,
I am facing problem with following plz help me ,
I want to use a subquery in Spaqrl.Can anyone help me how to use subquery in Sparql.I am using WSS 3.0 version.When i tried subquery it throws me with following exception.
SELECT ?shiftName WHERE{ harePointItems(?uri,?shiftName); { SELECT ?shiftName WHERE
{ harePointItems(?uri, "LogbookShift",?shiftInfo). } } } GROUP BY ?shiftName
Exception: Intuition Data Service has failed to execute the specified SPARQL query. } expected
Thanx in Advance
|
|
|
|
|
Hello, I am trying to find information on log shipping between SQL Server 2000 and 2008.
We are upgrading hardware, OS, and SQL, and are doing the fail-over server first then the production server. The problem is getting log shipping to work from 2000 to 2008 between the time we have the fail-over done and getting the production server done. (We estimate about a week or less.)
I have found some articles for migration but since this is a new build we are not upgrading. Not to mention we are going from Enterprise to Standard which has no migration path.
Thanks for any assistance.
djj
|
|
|
|