We help IT Professionals succeed at work.
Get Started

Sybase to SQL Server migration

chickanna
chickanna asked
on
233 Views
Last Modified: 2012-06-21
experts... I have a query in Sybase as below..

      SELECT h.StatusDate ,
           Count(*) AS TotalLoansExported,
               (SELECT COUNT(*)
            FROM ezadmin.ft_LoanMaster m
            WHERE (h.statusdate = m.statusdate))  AS TotalLoansImported,
                             (IF (TotalLoansImported > TotalLoansExported) THEN
                'Duplicates exist'
             ELSE
                IF (TotalLoansImported = TotalLoansExported) THEN
                    'Imported'
                ELSE
                    IF (TotalLoansImported = 0) THEN
                        'Not imported'
                    ENDIF
                ENDIF
             ENDIF) AS SystemMessage

    FROM ezadmin.ft_ImportHistory h
    WHERE (IALoanNum <> '')    
    GROUP BY h.StatusDate
              ORDER BY h.StatusDate DESC


I need to convert this to SQL Server 2005/2008 format. I get the famous "multipart identifier cannot be bound" error in the first line where the h.status_date is.

How do I correct this query to make it work in SQl Server. Thanks.
Comment
Watch Question
Database Analyst
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE