Problem With Select From 2000 To 2005

Oct 9, 2006

I have a query which was generated by a user using a report writter, so I have no control over what the user selected or how the query was generated.

The following query runs perfectly under SQL 2000 SP 4 32 bit and has for a long time. We are testing on a SQL 2005 SP1 (2153 Build) 64 bit with the exact same data.

The following query on SQL 2000 runs in 3 seconds, on SQL 2005 ran for 42 MINUTES before we cancelled it.

SELECT
CustomerID = TABLEB.CustomerID,
CustomerName = TABLEA.Group_Name_1_A,
CustomerContact = TABLEA.Group_Name_2_A
FROM
TABLEA
RIGHT OUTER JOIN TABLEB ON (TABLEB.CustomerID=TABLEA.CustomerID)
RIGHT OUTER JOIN TABLEC ON (TABLEC.CustomerID=TABLEB.CustomerID)
WHERE
TABLEB.CustomerID
IN (..  List of 38 CustomerIDs...)

Note: TABLEA and TABLEB are actually views into TABLEC. I don't know if that is relavant or not yet.

This appears to be this problem: http://support.microsoft.com/kb/318530 which existed in 2000 and was fixed with SP3. Can anyone confirm if this problem exists in 2005??

In diagnosing the problem, several things cause the query to work properly under 2005 and return in 3 seconds: Changing the WHERE TABLEB to WHERE TABLEA. Removing the RIGHT OUTER TABLEB, which is technically unneeded. The most interesting is shortening the WHERE IN clause to only 11 items, which is not possible for the report. Removing the PK from TABLEC OR making the PK index non-clustered.

The est execution plans between 2000 and 2005 is like comparing "Apples to Automobiles". That both start with "A" and that is about the only similarity.

Any ideas?

View 6 Replies


ADVERTISEMENT

Select Statement Works In 2000 But Not In 2005

Jan 2, 2008

I hope this is a easy one. We are trying to find a fix for a select statement that works in 2000 but not in 2005 with a simple select statement.

The easiest statement that will duplicate the error is:

TestTable has 3 columns: Primary, strTest, strTest2



SELECT strTest, strTest AS Name
FROM TestTable
ORDER BY strTest2



If you sort by the Primary column you will not receive an error.

How can you select the same column twice and then sort in the SQL statement?

View 3 Replies View Related

View SELECT Differences Between SQL 2000 && 2005

Apr 8, 2008

I have the following a view on a SQL2K box that uses the following SELECT statement:

SELECT



SF.SKU,
SAT.PublicationDate AS SATPubDate,
SAM.PublicationDate AS SAMPubDat
FROM SkuFlags SF
LEFT OUTER JOIN SpringArbor_ttlsparb SAT ON SF.ISBN = SAT.ISBN
LEFT OUTER JOIN SpringArbor_music SAM ON SF.ISBN = SAM.PrimaryKey
WHERE (
(
( SAT.PublicationDate IS NOT NULL ) AND
( SAT.PublicationDate <> '010001' ) AND
( GETDATE() <= DATEADD(day, -1, ( CAST(LEFT(SAT.PublicationDate, 2) + '/01/' + RIGHT(SAT.PublicationDate, 4) AS DATETIME) )))
)
OR (
( SAM.PublicationDate <> '010001' ) AND
( SAM.PublicationDate IS NOT NULL ) AND
( GETDATE() <= DATEADD(day, -1, ( CAST(LEFT(SAM.PublicationDate, 2) + '/01/' + RIGHT(SAM.PublicationDate, 4) AS DATETIME)))
)
)


The view works in SQL2K. When I try to run it under SQL2K5, I get a "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value." error. I know what the error is, the SAM.PublicationDate field has NULL values in it (and this is vendor supplied data that is updated frequently, so not dealing with NULL values isn't an option), so during the CAST function it's try to CAST NULL + /01/ + NULL into a DATETIME value and crashing.

My question is why this works in SQL2K and not SQL2K5?

Thanks,
Kevin

View 1 Replies View Related

SSRS 2005 V SSAS 2000 Mutli-Select Parameters

Nov 2, 2007

Has anyone managed to crack getting multi-select parameters to work from an SSRS 2005 report which is querying an SSAS 2000 cube.

SSRS 2005 does support Multiselect, however SSRS 2000 did not. Given that i am querying an SSAS 2000 cube, i get the impression that i am also limited to SSRS 2000 functionality regarding to multi-select parameters.

Is there anyone out there that ever managed to get a wor around, say by using filters on a table or anything really that coud simulate the same behaviour....

View 3 Replies View Related

Install Sql 2005 Instance With Reporting Service 2005 On Sql 2000 With RS 2000 Server

Aug 18, 2006

Hi

We would like to install Sql 2005 Enterprise Edition (including database engine, reporting service, integration service and analysis service) as a sepearte instance on a server which already has Sql 2000 with reporting services and analysis services. We do not want to disturb the existing sql 2000 setup.

If we do that then what will happen to my earlier sql 2000 reporting service? Will it be upgraded to sql 2005 reporting service? I heard that reporting services are instance unaware application. Where will be the default reporting service database available?

Please help us.

Regards,

Sankar N

View 1 Replies View Related

Select Data From 2000 Machine From A 2005 Machine

Jan 17, 2008

Hi,

here goes the question:

i have 1 sqlserver 2k5 machine (machine A) and sqlserver 2k (machine b)

how do i build a query to select data from 2k machine in a query of 2k5?

i mean something like

select *
from login:passw@machineb.dabatase.dbo.customers

thanks!

View 2 Replies View Related

Select Data From 2000 Machine From A 2005 Machine

Jan 17, 2008



Hi,

here goes the question:

i have 1 sqlserver 2k5 machine (machine A) and sqlserver 2k (machine b)

how do i build a query to select data from 2k machine in a query of 2k5?

i mean something like

select *
from loginassw@machineb.dabatase.dbo.customers

thanks!

View 6 Replies View Related

Multiple Tables Select Performance - SQL 2005 - Should It Take 90 Seconds For A Select?

Dec 4, 2007

I have a problem where my users complain that a select statement takes too long, at 90 seconds, to read 120 records out of a database.
The select statement reads from 9 tables three of which contain 1000000 records, the others contain between 100 and 250000 records.
I have checked that each column in the joins are indexed - they are (but some of them are clustered indexes, not unclustered).
I have run the SQL Profiler trace from the run of the query through the "Database Engine Tuning Advisor". That just suggested two statistics items which I added (no benefit) and two indexes for tables that are not involved at all in the query (I didn't add these).
I also ran the query through the Query window in SSMS with "Include Actual Execution Plan" enabled. This showed that all the execution time was being taken up by searches of the clustered indexes.
I have tried running the select with just three tables involved, and it completes fast. I added a fourth and it took 7 seconds. However there was no WHERE clause for the fourth table, so I got a cartesian product which might have explained the problem.
So my question is: Is it normal for such a type of read query to take 90 seconds to complete?
Is there anything I could do to speed it up.
Any other thoughts?
Thanks

View 7 Replies View Related

SQL 2005 Thinks A SQL 2000 Backup Is Corrupt, But SQL 2000 Restores Just Fine

Jul 19, 2007

I am attempting to move some SQL 2000 databases to SQL 2005. My main production database does not seem to want to move. When I use the SQL 2005 GUI the .bak backup file is marked 'Incomplete'. When I attempt to restore the backup file I get a 'RESTORE detected an error on page (0:0) in database' message. I saw a thread in the SQL Express forum suggesting trying to restore from the T-SQL level to get the GUI out of the picture and I get the same 'error on page (0:0)' message. However when I take the same file and use SQL 2000 Enterprise Manager it restores with no problems.

Any ideas?

Thanks
Mike Mattix

View 8 Replies View Related

Bit-data From SQL Server 2000 (2005 Working, 2000 Doesn't)

May 19, 2008

 Hi, I am trying to edit some data from a SQL2000-datasource in ASP.NET 2.0 and have a problem with a column that has bit-data and is used for selection. SQL2005 works fine when declaring             <SelectParameters>                <asp:Parameter DefaultValue="TRUE" Name="APL" Type="boolean" />            </SelectParameters>When running this code with SQL2000, there are no error-msgs, but after editing a record the "APL"-column looses its value of 1 and is set to 0. Looks like an issue with type-conversion, we've hit incompatibilities between SQL200 and 2005 with bit/boolean several times before. So, how is this done correctly with SQL2000?  (I've tried setting the Type to "int16" -> err. Also setting Defval="1" gave an err) ThanksMichael   

View 2 Replies View Related

Problems With SQL 2000 And 2005 On Same Machine - Can't Connect On 2000

Mar 13, 2006

Hi,i have SQL 2000 and 2005 on same machine(with different intance names,of course), my laptop - XP with SP2. The 2005 works fine but i can'tconnect on SQL 2000. All the the SQL services are started.Any idea? Have i to reinstall 2000?Tks,Lourival

View 1 Replies View Related

Merging 2000 And 2005 Databases, Save As 2000

Apr 30, 2008

I have to merge the data from two databases, one is in SQL Server 2005 format, one is in 2000. The merged data will then reside on a SQL Server 2000 platform. Is there an easy way to do this through Management Studio or Enterprise Manager? Or will we have to export the data from the 2005 database to a flat file and import it into a new 2000 database. And then do the merge?

TIA

View 4 Replies View Related

Log Shipping From 2005 In 2000 Compatibility Mode --&&> 2000 Can I Do This?

Dec 18, 2007

I am in the process of migrating from Sql Server 2000 to 2005. Part of my plan is to move some database's to 2005, but use the 2000 compatibility mode for the short term. My issue is this, our DR boxes are still on SQL Server 2000, would I still be able to use our log shipping processes? Or would I be better off in starting with migrating the DR boxes to 2005 first?


Thanks in advance.

View 3 Replies View Related

SQL 2000 To SQL 2005 Works For One 2000 Server But Not The Next

Jun 15, 2006



I have several SQL 2000 servers I need to setup transactional (non updatable) replication with. The structure is:

SQL Server 2000 as Publisher/Distributor

SQL Server 2005 Standard as Subscriber

The connection is via the Internet with snapshots using FTP.

I setup the first set (2 databases at location A). They work wonderfully. I created the publication and then subscribed using MGMT Studio for 2K5.

II am setting up the same scenario for location B. Here is my problem:

In MGMT Studio I connect to the publisher (SANDRA). I right-click a publication and choose New Subscriptions..., the publication is already selected. I click next - Run each agent at its Subscriber is selected and the only option (this is desired), I click Next

HERE IS THE PROBLEM:

On the Subscriber's screen there are no Subscribers listed. When setting up location A the subscribing server was listed and I could choose a database. The Next button is greyed out and there is no way to create/add one.

I tried setting up the subscription by right-clicking the subcribing server's Replication folder in MGMT Studio but I get the same result (except that I have to authenticate with the publishing server which works fine).

WHAT'S DIFFERENT:

Location A is SQL Server Standard (SP3) running on SBS2K3. It is obviously on a domain and so SQL Server and the SQL Agent are running under domain accounts. Location B is a Windows XP SP2 machine running SQL Server Personal Edition (it actually says Development Edition in the properties window).

The databases are the same strucutre, different data. At location A the firewall is set to allow 1433->*any* and *any*->1433 where *any* is 1024 or higher. On the XP machine the firewall is set to allow port 1433. I don't think this is the issue because I've turned the firewall off on the XP machine and I get the same result.

ANY IDEAS?

View 5 Replies View Related

Sql 2005 Sql 2000 DB Diagrams, Re-install Sql 2000, Need Help.....

Jan 19, 2007

Most of our sql servers ar still sql 2000. Our programmers created many sql 2000 database diagrams using EM. But they can not access them under sql 2005. (They now have only sql 2005 tools installed on their boxes.)

Question: can we reinstall the sql 2000 client tools on their boxes without affecting the current sql 2005 install on their boxes?

Question: is there any workaround negating the need to ihstall the sql 2000 client?

TIA,



barkingdog







View 1 Replies View Related

VS 2005/SQL Server2005 - Direct Connection From Win Mobile Emulator To Desktop SQL Server 2000 Or 2005

Aug 10, 2007

Hello Everyone,

I'm trying to connect to Desktop SQL Server 2000 from Windows mobile PC Emulator (VS 2005). I need a direct connection using connection string to SQL Server 2000 through local wireless network without IIS.

Bellow is the code that I use. After executing this code I get an error on line Conn.Open(). Error says SQL Server does not exist or access denied.
SQL is un and running, and I can log in using SA username from the desktop. Even if I chance IP for another SQL server in my connection string I still get the same error. There is no firewall of any kind running.


Dim connectionSTR As String = "Persist Security Info=False;Integrated Security=False;Server=192.168.0.202,1433;initial catalog=MyDB;user id=sa;password=;"

Dim Conn As SqlConnection

Conn = New SqlConnection(connectionSTR)

Conn.Open()


If Conn.State = ConnectionState.Open Then
MessageBox.Show("Open")
End If


About my environment: SQL Server 2000 is running on Desktop PC with Windows XP SP2. Application which I need to connect to SQL Server is in Visual Studio 2005. I execute the application in Windows Mobile PC Emulator and try to connect to SQL Server from emulator.

Your advice and help is very appreciated

Thank you

Ika


View 3 Replies View Related

Load Backup From 2000 To 2005 Or Recreate Structure On 2005?

Apr 23, 2008

Hello,

I would like to ask you if there is better to recreate database structure on 2005 from 2000 and move data or to just load
2000 backup.

Currently I loaded the backup, but I am wondering if there might be slightly better performance on 2005 when recreating structure on 2005 to loading 2000 backup?

Does loading 2000 backup create 2005 binary structure?

Thanks for help in advance

View 5 Replies View Related

Slow Select On Sql 2000 With Like '%value'

Jul 20, 2005

Hello.I test some query on sql server 2000 (sp2 on OS windows 2000) and iwant to know why a simple query like this :select * from Table Where Column like '%value'is more slow on 2000 than on sql 7.And this case arrive only if the % character is in the begin.If you test this :select * from Table Where Column like 'v%alue'then it's more fast on 2000.I look the execution plan, there is a difference but this differenceis the same in all the case i test (for the two query i write in thismessage for example).I don't understand why and so, if someone have an explanation, andperhaps a solution ...Excuse my poor english language.And thanks for time people spend to answer me.

View 2 Replies View Related

How Do SQL 2000 Service Packs Play A Role In Upgrading?i.e.Can SQL 2000 Standard With No SP Be Upgraded To SQL 2005 Standard

Aug 2, 2006

How do SQL 2000 service packs play a role in upgrading? That is, can SQL 2000 Standard with no Service Packs(SP) be upgraded to SQL 2005 Standard, or does SQL 2000 Standard have to have a certain service pack??

View 1 Replies View Related

Can I Install VS.net 2005 / VS.net 2002 / SQL 2005 / SQL 2000 In One PC Win2000 Sp4?

Dec 1, 2005

P4 2.8G Hz, 512 M RAM.thanks.

View 3 Replies View Related

What Will Going From Latin1_General_Bin To Latin1_General_Bin2 In SQL 2005 Do To Replication From 2000 To 2005?

Aug 3, 2006

If we changed the sort order from BIN to BIN2 but kept everything else the same will it have any effect on replication? So in SQL 2005 if I were to change my default collation from Latin1_General_Bin to Latin1_General_Bin2, would that cause replication to break? I suspect that it will not be an issue since it is just sort order that is changing and the code page stays the same.

BTW, this is transactional replication.  Sorry, I left that out of my original post.

Thanks,
Grant

View 1 Replies View Related

Select 100.000.000 Records In Sql Server 2000

Jan 18, 2006

Hi all, i have a trouble when i want to select 100.000.000 records in a table, Pls, give me a solution thanks

View 4 Replies View Related

SELECT DATE Problem SQL 2000

Feb 14, 2006

I am runing this VIEW :

SELECT users.id FROM users WHERE CONVERT(DATETIME, users.Inscription, 111) = CONVERT(DATETIME, '2006/02/14 12:00:00', 111)

the datestyle 111 = yy/mm/dd

I want to compare the dates without the times

the view returns nothing when they are > 10 rows in the database for 2006/02/14

how can i search on universal date yy/mm/dd ? or yyyy/mm/dd

in the datestyle there is nothing for yyyy/mm/dd thats crazy !

thank you for helping


date styles : http://www.sqljunkies.com/Article/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk

View 4 Replies View Related

How To Do Recursive Select In SQL Server 2000

May 4, 2006

Suppose there's a table named [Category], which has 2 columns:
CategoryID int,
ParentCategoryID int

Each category, except the top most, has a parent category, it's a 1-to-n parent-children relationship.
Now I want to write a stored proc./function that accepts a CategoryID input parameter, and output all the descendent CategoryIDs (son, grand son, ...). How to do that in MSSQL 2000?

View 1 Replies View Related

SQL Server 2000 Timeout On SELECT Query

Mar 29, 2007

 The SQL statement below works without the WHERE statement but as soon as i try to use the where it stops working, I think it has something to do with the HAVING statement in the vwMultiAE2 view but I am not sure.It did the same thing when I had it in one view. Anyone know what is going on here?SELECT Ch, Reg, FMM, AE, Acc, Totals FROM vwMultiAE2 WHERE (g1ID = @g1 or @g1 = 'All') AND (g2ID = @g2 or @g2 = 'All') AND (g3ID = @g3 or @g3 = 'All') AND (AEID = @g4 or @g4 = 'All')
 
vwMultiAE2 >
 SELECT TOP 100 PERCENT
Ch,
Reg,
FMM,
AE,
Acc,
Totals,
g1ID,
g2ID,
g3ID,
AEID
FROM
vwMultAE
WHERE
Account_ID IN (SELECT Account_ID FROM vwMultAE GROUP BY g2ID, Account_ID HAVING ( COUNT(Account_ID) > 1 ))
ORDER BY
g2ID, Account_ID 
 
 
 

View 5 Replies View Related

If Condition Within Select Query Sql Server 2000

Dec 16, 2007

Hi all,
 
I have to write a select query which need some logic to be implemented.
Query is like
select name,number,active,
if active ="true" then
select @days=days from tbl_shdsheet
else
@days=''
end
from tbl_emp
 In the above query there will be days row for that employee if active is true else there won't be any data for that emp in the tbl_shdsheet
So how can i write queery for this.

View 3 Replies View Related

SQL SERVER 2000 SELECT Waiting And Locks

Jun 17, 2004

Is anyone have already encountered such a problem :

When a table is locked by several locks (key, pag), either a SELECT request which does not need to lock any row cannot succeed.

In SQL Server Enterprise Manager, I see that my request is waiting for a lock "LCK_M_S" !!!

How I can avoid this kind of situation which seems to me completely abnormal.

I have never been faced with this kind of problem in Oracle.

Thanks for anyone who will help me to resolve this "bug".

View 4 Replies View Related

How To Select Few Row Data From SQL Server 2000 Database

Apr 4, 2006

i am facing a problems, hope that anyone who know the answer can help me.

i am using sql server 2000 and vs.net. i wan to retrieve a data from the table which only select 3 top row based on their different contingentID. the table have different contingent and each contingent have 5 row data. i wan to retrieve 3 top row based on the total group by contingentID and sum up the total to order by the total and generate the ranking based on total. what i can do is only retrieve every row of data in that table. so anyone know the answer please help me, or if u dun understand my question , can message me..thank your



Skyline...

2006-04-04

View 3 Replies View Related

How To Randomly Select Records From Sql Server 2000 To ASP.NET(vb Language)

Mar 19, 2008

Hai friends,,
  I have a table name "Student"
it contain 2 fields no ,name
no      name
1        Raja
2        Larsen
3        Ravi
4        Ankit
5        Eban
my questions  is I have a webform random.aspx
whenever any user open a webform random.aspx
it should display anyone of name  in a random order..... CODING:-
Dim cn As New System.Data.sqlclient.SqlConnectionDim rd As sqlDataReader
cn.ConnectionString = "Persist Security Info=False;User ID=sa;Initial Catalog=master;password=david;"
cn.Open()Dim cmd1 As New SqlCommand("select no,name from Student", cn)  ' how i can chage to random order....
rd = cmd1.ExecuteReader
rd.Read()
Response.Write(rd(0) & "." & rd(1))
rd.Close()
thank u..
Ambrose...
 
 

View 4 Replies View Related

Cannot Find Select Stored Procedure Wizard In SQL 2000

Jul 20, 2005

I was using the SQL 2000 stored procedure wizard to create storedprocedures. I can create insert, delete and update SPs however I amnot able to create the select SP. The wizard does not offer the optionof selecting "select" type SP. thank you for your replyscompraj

View 1 Replies View Related

Select Statement In Sql Server 2000 Is Taking Too Long??

Jul 20, 2005

Hi All,I am facing problem in MS SQL Server 2000. It is behaving slow forselect statements. It is even slower than MS ACCESS. For example, if iuse"Select count(*) from tbl;". i get the results after long time ifthere is more than 100k rows. What might be the possible reasons forthis??ThanksHoque

View 1 Replies View Related

SQL Server 2000 Deadlock Concurrent Select Transcations

Oct 14, 2007

There are a series of traces of transactions for essentially the same units of work. Each includes a retrieving the same table "Select" from the database. The first 4 transactions ran concurrently. The last one ran about 7 minutes later with no other concurrent transactions.

The elapsed times for the database accesses for each of the first 4 is significantly higher than the last one.
Can you think of any database optimazation that might improve this?


Are there any utilities available than can be used for stand-alone testing of SQL Server database performance?
E.G. they would measure response time for reading/writing large/small amounts of canned data once/multiple times with concurrent/nonconcurrent access.

SQL Server Database is on 2000.I am not sure about the ISOLATION level in the Java code.

Basically I am new to SQL Sever....Please ans the above questions and provide me the direction to proceed on these questions

View 5 Replies View Related

Update Set Of Columns Using Select Query In Sqlserver 2000

Feb 14, 2008

hi !!!!!!!!!!!!!!!!!!!!!!!
I have 3 tables

let say Employee,Employee_temp,emp_approval

i want to update employee table by selecting columns from employee_temp

i do that using oracle but i want it using sql server 2000

Sample syntax Below: for oracle

update employee e set (col1,col2,col3,col4)=
(select t1.col1,t1.col2,t1.col3,t1.col4 from employee_temp t where t.col1=:new.col1) where e.col1=:new.col1


this syntax for oracle....

plsease provide sql 2000 syntax and sql 2005 syntax please.........


thank you.

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved