Avatar of SwamyN
SwamyN

asked on 

Multipart identifier could not be bound error while migrating from SQL server 2000 to 2005

Multipart identifier could not be bound error while migrating from SQL server 2000 to 2005

When executing the below mentioned query in SQL server 2005 the following error occurs

Multipart identifier dbo.fn_getFinid could not be bound

The query works fine in SQL sever 2000

The query that is errorenous :
 
Select EmpCode, LeaveShortName, sum(LeaveValue) As LeaveTaken From txnLeaveDebits Where EmpCode = '10050' And LeaveId = 'LV0001' and ApplicationType <> 10 and  status <> 2 And dbo.fn_getFinid(fromdate,todate) = 'FY0002 ' Group By EmpCode, LeaveShortName
 
The user defined function : fn_getFinid
 
CREATE   function fn_getFinid(@fromdate as datetime,@todate as datetime) returns varchar(6) begin Declare @FinYearid_fr as varchar(6) Declare @FinYearid_to as varchar(6) set @FinYearid_fr = (select finyearid  from dbo.atFinancialYear where @fromdate between fromdate and todate ) set @FinYearid_to = (select finyearid  from dbo.atFinancialYear where @todate between fromdate and todate ) if @finyearid_fr <> @finyearid_to     set @finyearid_fr = null return @finyearid_fr end

Open in new window

Microsoft SQL Server 2005

Avatar of undefined
Last Comment
Guy Hengel [angelIII / a3]
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft SQL Server 2005
Microsoft SQL Server 2005

Microsoft SQL Server 2005 is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning. It includes support for managing XML data and allows a database server to be exposed over web services using Tabular Data Stream (TDS) packets encapsulated within SOAP (protocol) requests.

72K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo