Jason Yu
asked on
The multi-part identifier "X" could not be bound
I created a crystal report based on a view, the view code is as following;
USE [Live_45]
GO
/****** Object: View [dbo].[cst_adStuStatusChan gesUpdate_ jy_vw] Script Date: 09/04/2012 17:11:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW [dbo].[cst_adStuStatusChan gesUpdate_ jy_vw]
AS
SELECT rpt_AdStatusChanges_vw.Beg inDate, rpt_AdStatusChanges_vw.Dat eAdded, rpt_AdStatusChanges_vw.Sta tus,
rpt_AdStatusChanges_vw.SyS choolStatu sDescrip, rpt_AdStatusChanges_vw.Sta tusSort, rpt_AdStatusChanges_vw.Pre vSySchoolS tatusID,
rpt_AdStatusChanges_vw.Pre vStatus, rpt_AdStatusChanges_vw.New SySchoolSt atusID, rpt_AdStatusChanges_vw.New StatDescri p,
rpt_AdStatusChanges_vw.SyS choolStatu sID, rpt_AdStatusChanges_vw.Cur rentStatus , rpt_AdStatusChanges_vw.Eff ectiveDate ,
CAST(rpt_AdStatusChanges_v w.Internal Comm AS varchar(899)) AS InternalComm, rpt_AdStatusChanges_vw.ByU ser, rpt_AdStatusChanges_vw.Cou nter,
rpt_AdStatusChanges_vw.Cat egory, rpt_AdStatusChanges_vw.Cat egoryStatu s, rpt_AdStatusChanges_vw.Enr ollments,
rpt_AdStatusChanges_vw.Stu dentName, rpt_AdStatusChanges_vw.SSN , rpt_AdStatusChanges_vw.enr ollNum, rpt_AdStatusChanges_vw.App lDate,
rpt_AdStatusChanges_vw.Stu Num, rpt_AdStatusChanges_vw.SyS tudentId, ' ' AS PrintID, rpt_AdStatusChanges_vw.Enr ollID,
rpt_AdStatusChanges_vw.Stu dentID, rpt_AdStatusChanges_vw.Com ment, rpt_AdStatusChanges_vw.Pgm VerCde, rpt_AdStatusChanges_vw.Shi ftDesc,
rpt_AdStatusChanges_vw.Cam pus, rpt_AdStatusChanges_vw.Dat eStarted, rpt_AdStatusChanges_vw.Enr ollDescrip ,
rpt_AdStatusChanges_vw.fBe ginDate, rpt_AdStatusChanges_vw.fRe turnDate, rpt_AdStatusChanges_vw.Syc ampusID,
rpt_AdStatusChanges_vw.Pro gramVersio n, rpt_AdStatusChanges_vw.Cam pusCode, rpt_AdStatusChanges_vw.Stu dentNameEn roll,
rpt_AdStatusChanges_vw.Rea son, rpt_AdStatusChanges_vw.New StatCatego ry, rpt_AdStatusChanges_vw.Sto redLDA,
rpt_AdStatusChanges_vw.Stu dentPhone, rpt_AdStatusChanges_vw.Stu dentAddres s, rpt_AdStatusChanges_vw.Stu dentCity,
rpt_AdStatusChanges_vw.Stu dentState, rpt_AdStatusChanges_vw.Stu dentCountr y, rpt_AdStatusChanges_vw.Stu dentZip,
rpt_AdStatusChanges_vw.NSL DSWithdraw alDate, rpt_AdStatusChanges_vw.Dro pDate, dbo.SyStaff.SyStaffID, dbo.SyStaff.FirstName,
dbo.SyStaff.LastName
FROM dbo.rpt_AdStatusChanges_vw INNER JOIN
dbo.syStudent WITH (nolock) ON rpt_AdStatusChanges_vw.SyS tudentID = SyStudent.SyStudentID INNER JOIN
dbo.SyStaff ON dbo.syStudent.AmRepID = dbo.SyStaff.SyStaffID LEFT OUTER JOIN
dbo.AdEnroll WITH (nolock) ON adenroll.adenrollid = rpt_AdStatusChanges_vw.enr ollid
WHERE (1 = 1)
GO
When I tried to run the report, I got the following error:
The multi-part identifier "cst_adStuStatusChangesUpd ate_jy_vw. SyCampusID " could not be bound. (Source: Microsoft OLE DB Provider for SQL Server).
Any help will be great appreciated, thank you.
CV-error.jpg
USE [Live_45]
GO
/****** Object: View [dbo].[cst_adStuStatusChan
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW [dbo].[cst_adStuStatusChan
AS
SELECT rpt_AdStatusChanges_vw.Beg
rpt_AdStatusChanges_vw.SyS
rpt_AdStatusChanges_vw.Pre
rpt_AdStatusChanges_vw.SyS
CAST(rpt_AdStatusChanges_v
rpt_AdStatusChanges_vw.Cat
rpt_AdStatusChanges_vw.Stu
rpt_AdStatusChanges_vw.Stu
rpt_AdStatusChanges_vw.Stu
rpt_AdStatusChanges_vw.Cam
rpt_AdStatusChanges_vw.fBe
rpt_AdStatusChanges_vw.Pro
rpt_AdStatusChanges_vw.Rea
rpt_AdStatusChanges_vw.Stu
rpt_AdStatusChanges_vw.Stu
rpt_AdStatusChanges_vw.NSL
dbo.SyStaff.LastName
FROM dbo.rpt_AdStatusChanges_vw
dbo.syStudent WITH (nolock) ON rpt_AdStatusChanges_vw.SyS
dbo.SyStaff ON dbo.syStudent.AmRepID = dbo.SyStaff.SyStaffID LEFT OUTER JOIN
dbo.AdEnroll WITH (nolock) ON adenroll.adenrollid = rpt_AdStatusChanges_vw.enr
WHERE (1 = 1)
GO
When I tried to run the report, I got the following error:
The multi-part identifier "cst_adStuStatusChangesUpd
Any help will be great appreciated, thank you.
CV-error.jpg
That would tend to indicate that particular column doesn't exist. Verify the spelling.
Capitalization may make a difference
mlmcc
Capitalization may make a difference
mlmcc
Does this run in SQL Manager?
I found at times with Crystal that a view got too long to be used. You might try aliasing the view and table names so you don't have to repeat them in the SELECT as shown below
SELECT AD.SyCampusID
FROM dbo.rpt_AdStatusChanges_vw AD
mlmcc
I found at times with Crystal that a view got too long to be used. You might try aliasing the view and table names so you don't have to repeat them in the SELECT as shown below
SELECT AD.SyCampusID
FROM dbo.rpt_AdStatusChanges_vw
mlmcc
ASKER
I run the command you listed, and it give me syCampusID =11 for each row.
I checked the code, there is a line like this:
rpt_AdStatusChanges_vw.fBe ginDate, rpt_AdStatusChanges_vw.fRe turnDate, rpt_AdStatusChanges_vw.Syc ampusID,
I was wondering why it doesn't use cst_adStuStatusChangesUpda te_jy_vw as a prefix instead of using another view's name as the prefix, does this matter. Do I need change all the prefix in this view to cst_adStuStatusChangesUpda te_jy_vw which is the new view.
Forgive me bad understanding, I am quite new to TSQL and View.
thank you.
I checked the code, there is a line like this:
rpt_AdStatusChanges_vw.fBe
I was wondering why it doesn't use cst_adStuStatusChangesUpda
Forgive me bad understanding, I am quite new to TSQL and View.
thank you.
No. You prefix the cloolumn names witht he table or view name they come from.
Note your view uses rpt_AdStatusChanges_vw.Syc ampusID but the select statement suggested uses rpt_AdStatusChanges_vw.syC ampusID.
Change your view to use the correct capitalization.
mlmcc
Note your view uses rpt_AdStatusChanges_vw.Syc
Change your view to use the correct capitalization.
mlmcc
ASKER
I changed the captions to "[SyCampusID]" , and relink the code with crystal report, but it's still not working.
rpt_AdStatusChanges_vw.fBe ginDate, rpt_AdStatusChanges_vw.fRe turnDate, rpt_AdStatusChanges_vw.SyC ampusID,
I copied the original code and make it clear to see and attach the file here.
dbo.cst-adStuStatusChangesUpdate.txt
rpt_AdStatusChanges_vw.fBe
I copied the original code and make it clear to see and attach the file here.
dbo.cst-adStuStatusChangesUpdate.txt
ASKER
Is there some problem with the footer section.
the code from the original crystal report is as follows:
<SELECTION>
rpt_adStatusChanges_vw.New SySchoolSt atusID(SyS tatusCateg ory:A;E;L; N;P;T;C;)
rpt_adStatusChanges_vw.Pre vSySchoolS tatusID(Sy SchoolStat us:A;E;L;N ;P;T;C;)
rpt_adStatusChanges_vw.New SySchoolSt atusID(SyS choolStatu s:A;E;L;N; P;T;C;)
rpt_adStatusChanges_vw.Eff ectiveDate ()
rpt_adStatusChanges_vw.SyC ampusID(Sy CampusGrp)
rpt_adStatusChanges_vw.AdS hiftID(AdS hift)
rpt_adStatusChanges_vw.Dat eAdded()
rpt_adStatusChanges_vw.AdR easonID(Ad Reason)
rpt_adStatusChanges_vw.SyS choolStatu sID(SyScho olStatus)
The new footer after my modification is as below:
<SELECTION>
cst_adStuStatusChangesUpda te_jy_vw.N ewSySchool StatusID(S yStatusCat egory:A;E; L;N;P;T;C; )
cst_adStuStatusChangesUpda te_jy_vw.P revSySchoo lStatusID( SySchoolSt atus:A;E;L ;N;P;T;C;)
cst_adStuStatusChangesUpda te_jy_vw.N ewSySchool StatusID(S ySchoolSta tus:A;E;L; N;P;T;C;)
cst_adStuStatusChangesUpda te_jy_vw.E ffectiveDa te()
cst_adStuStatusChangesUpda te_jy_vw.S yCampusID( SyCampusGr p)
cst_adStuStatusChangesUpda te_jy_vw.A dShiftID(A dShift)
cst_adStuStatusChangesUpda te_jy_vw.D ateAdded()
cst_adStuStatusChangesUpda te_jy_vw.A dReasonID( AdReason)
cst_adStuStatusChangesUpda te_jy_vw.S ySchoolSta tusID(SySc hoolStatus )
I only changed the prefix in the footer in the new crystal report. Any effect? I notice when I run the report from the front, it doesn't give me the selection box as the old crystal report does. Please see the print screen for detail.
OldReportWorkingFineWithSelectio.jpg
NewReportIsNotWorkingFineWithSel.jpg
the code from the original crystal report is as follows:
<SELECTION>
rpt_adStatusChanges_vw.New
rpt_adStatusChanges_vw.Pre
rpt_adStatusChanges_vw.New
rpt_adStatusChanges_vw.Eff
rpt_adStatusChanges_vw.SyC
rpt_adStatusChanges_vw.AdS
rpt_adStatusChanges_vw.Dat
rpt_adStatusChanges_vw.AdR
rpt_adStatusChanges_vw.SyS
The new footer after my modification is as below:
<SELECTION>
cst_adStuStatusChangesUpda
cst_adStuStatusChangesUpda
cst_adStuStatusChangesUpda
cst_adStuStatusChangesUpda
cst_adStuStatusChangesUpda
cst_adStuStatusChangesUpda
cst_adStuStatusChangesUpda
cst_adStuStatusChangesUpda
cst_adStuStatusChangesUpda
I only changed the prefix in the footer in the new crystal report. Any effect? I notice when I run the report from the front, it doesn't give me the selection box as the old crystal report does. Please see the print screen for detail.
OldReportWorkingFineWithSelectio.jpg
NewReportIsNotWorkingFineWithSel.jpg
ASKER
I modified the code as you suggested using alias.
USE [Live_45]
GO
/****** Object: View [dbo].[cst_adStuStatusChan gesUpdate_ jy_vw] Script Date: 09/05/2012 11:54:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW [dbo].[cst_adStuStatusChan gesUpdate_ jy_vw]
AS
SELECT AD.BeginDate,
AD.DateAdded,
AD.Status,
AD.SySchoolStatusDescrip,
AD.StatusSort,
AD.PrevSySchoolStatusID,
AD.PrevStatus,
AD.NewSySchoolStatusID,
AD.NewStatDescrip,
AD.SySchoolStatusID,
AD.CurrentStatus,
AD.EffectiveDate,
CAST(AD.InternalComm AS varchar(899)) AS InternalComm, AD.ByUser, AD.Counter,
AD.Category, AD.CategoryStatus, AD.Enrollments,
AD.StudentName, AD.SSN, AD.enrollNum, AD.ApplDate,
AD.StuNum, AD.SyStudentId, ' ' AS PrintID, AD.EnrollID,
AD.StudentID, AD.Comment, AD.PgmVerCde, AD.ShiftDesc,
AD.Campus, AD.DateStarted, AD.EnrollDescrip,
AD.fBeginDate, AD.fReturnDate, AD.SyCampusID,
AD.ProgramVersion, AD.CampusCode, AD.StudentNameEnroll,
AD.Reason, AD.NewStatCategory, AD.StoredLDA,
AD.StudentPhone, AD.StudentAddress, AD.StudentCity,
AD.StudentState, AD.StudentCountry, AD.StudentZip,
AD.NSLDSWithdrawalDate, AD.DropDate, dbo.SyStaff.SyStaffID, dbo.SyStaff.FirstName,
dbo.SyStaff.LastName
FROM dbo.rpt_AdStatusChanges_vw AD INNER JOIN
dbo.syStudent WITH (nolock) ON AD.SyStudentID = SyStudent.SyStudentID INNER JOIN
dbo.SyStaff ON dbo.syStudent.AmRepID = dbo.SyStaff.SyStaffID LEFT OUTER JOIN
dbo.AdEnroll WITH (nolock) ON adenroll.adenrollid = AD.enrollid
WHERE (1 = 1)
GO
USE [Live_45]
GO
/****** Object: View [dbo].[cst_adStuStatusChan
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW [dbo].[cst_adStuStatusChan
AS
SELECT AD.BeginDate,
AD.DateAdded,
AD.Status,
AD.SySchoolStatusDescrip,
AD.StatusSort,
AD.PrevSySchoolStatusID,
AD.PrevStatus,
AD.NewSySchoolStatusID,
AD.NewStatDescrip,
AD.SySchoolStatusID,
AD.CurrentStatus,
AD.EffectiveDate,
CAST(AD.InternalComm AS varchar(899)) AS InternalComm, AD.ByUser, AD.Counter,
AD.Category, AD.CategoryStatus, AD.Enrollments,
AD.StudentName, AD.SSN, AD.enrollNum, AD.ApplDate,
AD.StuNum, AD.SyStudentId, ' ' AS PrintID, AD.EnrollID,
AD.StudentID, AD.Comment, AD.PgmVerCde, AD.ShiftDesc,
AD.Campus, AD.DateStarted, AD.EnrollDescrip,
AD.fBeginDate, AD.fReturnDate, AD.SyCampusID,
AD.ProgramVersion, AD.CampusCode, AD.StudentNameEnroll,
AD.Reason, AD.NewStatCategory, AD.StoredLDA,
AD.StudentPhone, AD.StudentAddress, AD.StudentCity,
AD.StudentState, AD.StudentCountry, AD.StudentZip,
AD.NSLDSWithdrawalDate, AD.DropDate, dbo.SyStaff.SyStaffID, dbo.SyStaff.FirstName,
dbo.SyStaff.LastName
FROM dbo.rpt_AdStatusChanges_vw
dbo.syStudent WITH (nolock) ON AD.SyStudentID = SyStudent.SyStudentID INNER JOIN
dbo.SyStaff ON dbo.syStudent.AmRepID = dbo.SyStaff.SyStaffID LEFT OUTER JOIN
dbo.AdEnroll WITH (nolock) ON adenroll.adenrollid = AD.enrollid
WHERE (1 = 1)
GO
Did that help?
mlmcc
mlmcc
ASKER
In fact, No.
do you mind have a remote session and take a look, I have gotomeeting to hold a meeting.
thank you.
do you mind have a remote session and take a look, I have gotomeeting to hold a meeting.
thank you.
ASKER
Hi, mlmmc:
I recreated the view file, it is partially working. The only problem is the three fields I added in the view don't show on the crystal report. When I run the select query based on this new view, it shows.
The code is as in the attachment.
NewView.txt
I recreated the view file, it is partially working. The only problem is the three fields I added in the view don't show on the crystal report. When I run the select query based on this new view, it shows.
The code is as in the attachment.
NewView.txt
ASKER
After I created a new view and try to run the report from front end, it gives me error;
"This field name is not known. " Please help, thank you very much.
The-field-name-is-unknow.jpg
"This field name is not known. " Please help, thank you very much.
The-field-name-is-unknow.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I verified database as you instructed and tried to run the report. It still shows "This field name is not known. ", if I don't use those three newly added fields, the report works fine. That means the newly added fields have problem.
did you have a chance to look at the code. The newly added fields are from a different table instead from the old view.
I did a select query based on the new view from SQL Server management Studio, the result windows shows all the fields including the three newly added fields. But when I run the crystal report, it doesn't.
Thank you.
did you have a chance to look at the code. The newly added fields are from a different table instead from the old view.
I did a select query based on the new view from SQL Server management Studio, the result windows shows all the fields including the three newly added fields. But when I run the crystal report, it doesn't.
Thank you.
Are those the Staff fields?
mlmcc
mlmcc
ASKER
Yes, They are from SyStaff table. The working fields are from an old view.
Is this the problem: I can't create a new view based on an old view and a table?
Please advise.
Is this the problem: I can't create a new view based on an old view and a table?
Please advise.
ASKER
Any Update, mlmcc, I hope you can give me some update. thank you.
ASKER
I got the solution, it's the databse connectio problem. On the campusvue system, the front end report name should be the same as the procedure's name. I used different names, that created the problem. After I called the customer service, they solved this hard issue.
Hi Jason,
What are the new fields that you added to the view and are you modifying the cs5)adstustatuschanges_vw? The crystal report name and the view name have to match. If the report name is adtest.rpt the corresponding view would be adtest_vw.
Thanks,
Peter
Hi Jason,
What are the new fields that you added to the view and are you modifying the cs5)adstustatuschanges_vw?
Thanks,
Peter
Excellent. I doubt any of us would have known that or figured it out.
mlmcc
mlmcc
select SyCampusID from cst_adStuStatusChangesUpda