Showing posts with label perfectly. Show all posts
Showing posts with label perfectly. Show all posts

Wednesday, March 28, 2012

outerjoint

Hi all - I am new to MsSQL and need a bit of help.
I have a query that works perfectly in Oracle but not in MsSQL. I understand that there are different commands in MsSQL and for the life of me I cannot find them. Can someone help? Here is the query.

Select c.*, ins.id from CASES c, INSPECTOR ins
where c.id = &intID
and ins.id (+) = decode(c.inspector_id,1,null,c.inspector_id)

Cheers
HekiSelect c.*, ins.id
from CASES c
LEFT OUTER JOIN
INSPECTOR ins ON
ins.id = decode(c.inspector_id,1,null,c.inspector_id) AND
c.id = &intID;|||sql server doesn't support DECODE

select c.*
, ins.id
from CASES c
left outer
join INSPECTOR ins
on case when c.inspector_id = 1
then null
else c.inspector_id end = ins.id
and c.id = &intID

Tuesday, March 20, 2012

Other databases stopped working

I have a similar problem but not with the sample databases. All the sample databases work perfectly fine but all my other databases that were hosted appear to have similar error
"The database cannot be opened because it is version 607. This server supports version 603 and earlier. A downgrade is not supported"
I'm using the SQL Server that came with Visual Studio 2005 Beta 2. Version 9.01116
Any ideas?

The error message indicates that your other databases were created in a version of SQL Server 2005 newer than the version of SQL Server included in the VS Beta2. Databases are not backward compatible, so that's why you're getting the error. Did you have another version of SQL Server installed before you installed the VS Beta (perhaps the June CTP or the September CTP) ?

Assuming that's what happened, here are a couple of possible solutions.

1. Install the September CTP version of SQL Server 2005 from http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/ctp.mspx and try to attach these databases there. (This leaves the older version of SQL Server in place).
or
2. Uninstall the current version and install the September CTP. The September CTP bits are compatible with VS Beta 2, so this shouldn't create any problems.

These solutions might or might not work depending on which versions the September CTP supports. If this doesn't work, you'll need to install an older version like the June CTP and try to attach the databases there. For the June CTP Express Edition, see http://www.microsoft.com/downloads/details.aspx?FamilyId=1A722B0F-6CCA-4E8B-B6EA-12D9C450ED92&displaylang=en . For the June CTP Developer Edition, see http://www.microsoft.com/downloads/details.aspx?FamilyId=B414B00F-E2CC-4CAB-A147-EACA26740F19&displaylang=en.

Hope that helps.
Regards,