troubleshooting Question

Sybase to SQL Server migration

Avatar of chickanna
chickannaFlag for Afghanistan asked on
Microsoft SQL Server
5 Comments1 Solution239 ViewsLast Modified:
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.
ASKER CERTIFIED SOLUTION
lcohan
Database Analyst
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros