August 29, 2013 at 9:08 am
Anyone have any ideas on why I'm getting
Mult-part Identifier cannot be bound error on the following
Thanks
Joe
SELECT [rpt_v_ch_all clients].LName + ', ' + ISNULL([rpt_v_ch_all clients].FName, ' ') AS clientname
,dbo.[rpt_v_ch_all clients].Client_ID
,dbo.[rpt_v_ch_all clients].LName
,dbo.[rpt_v_ch_all clients].FName
,dbo.[rpt_v_ch_all clients].AdmitDate
,dbo.[rpt_v_ch_all clients].DischargeDate
,dbo.[rpt_v_ch_all clients].Code
,dbo.[rpt_v_ch_all clients].AbbrName
,dbo.[rpt_v_ch_all clients].ID AS Expr1
,dbo.[JBD_V_CH_Info].ENDTIME
,dbo.JBD_V_CH_Info.poscode
,dbo.JBD_V_CH_Info.dmcode
,dbo.JBD_V_CH_Info.dmabbr
,dbo.JBD_V_CH_Info.posabbr
,dbo.JBD_V_CH_Info.CAD226
,dbo.JBD_V_CH_Info.CAD204
,dbo.JBD_V_CH_Info.CAD205
,dbo.JBD_V_CH_Info.CAD207
,dbo.JBD_V_CH_Info.CAD227
,dbo.JBD_V_CH_Info.FullName
,dbo.JBD_V_CH_Info.BOX
,dbo.JBD_V_CH_Info.OCount
,dbo.JBD_V_CH_Info.SCount
,dbo.JBD_V_CH_Info.[Days Diff]
,dbo.JBD_V_CH_Info.RECORDED_SERVICE_VOIDED_MONIKER
,dbo.JBD_V_CH_Info.datepartofstarttime
,dbo.JBD_V_CH_Info.CLIENT_IDENTIFIER
,dbo.JBD_V_CH_Info.Expr1 AS Expr3
,dbo.JBD_V_CH_Info.CIEffdate
,dbo.JBD_V_CH_Info.CIexpdate
,dbo.JBD_V_CH_Info.ID
,dbo.JBD_V_CH_Info.STARTTIME
FROM dbo.[JBD_V_CH_Info]
RIGHT JOIN dbo.[rpt_v_ch_all clients] ON dbo.JBD_V_CH_Info.ID = dbo.[rpt_v_ch_all clients].ID
August 29, 2013 at 10:27 am
It's DatabaseName + Schema + Object
i.e. [JBD_V_CH_Info].dbo.TableName
Looks like you have Schema.Table.Column in your query...try:SELECT rpt.LName + ', ' + ISNULL(rpt.FName, ' ') AS clientname
,rpt.Client_ID
,rpt.LName
,rpt.FName
,rpt.AdmitDate
,rpt.DischargeDate
,rpt.Code
,rpt.AbbrName
,rpt.ID AS Expr1
,jbd.ENDTIME
,jbd.poscode
,jbd.dmcode
,jbd.dmabbr
,jbd.posabbr
,jbd.CAD226
,jbd.CAD204
,jbd.CAD205
,jbd.CAD207
,jbd.CAD227
,jbd.FullName
,jbd.BOX
,jbd.OCount
,jbd.SCount
,jbd.[Days Diff]
,jbd.RECORDED_SERVICE_VOIDED_MONIKER
,jbd.datepartofstarttime
,jbd.CLIENT_IDENTIFIER
,jbd.Expr1 AS Expr3
,jbd.CIEffdate
,jbd.CIexpdate
,jbd.ID
,jbd.STARTTIME
FROM dbo.[JBD_V_CH_Info] jbd
RIGHT JOIN dbo.[rpt_v_ch_all clients] rpt ON jbd.ID = rpt.ID
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
August 29, 2013 at 10:30 am
sorry left out a big part these are views
August 29, 2013 at 10:56 am
Yes I could tell from the "AS Expr1" very common when creating a view from the GUI and then looking at the code 🙂 Has the schema on the table changed? If so, try running sp_refreshview 'NameOfView' and see if the issues goes away.
Using an alias (as in the example I provided) should work right away though - did you try it this way?
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
August 29, 2013 at 1:38 pm
Hi MDJ..
Thanks for the info, yes yours works and I added some logic etc and I'm getting output for a SSRS report..
Still get the "squiggly" but working.
While I'm here..
I think this is a real sloppy way Im getting at the data
ANy suggestions on where I can learn about temp tables.
Here is what i am doing maybe you can suggest a better way...
Currently I have two views.
1 pulls all clients in a program, the second pull any data on the clients,
I did it in two because some client may not have data and still wanted on the matrix report
so what I dis was view1 has all clients view2 has data and right joined on on two
Just suggestions would be great
Thanks Again
Joe
August 29, 2013 at 1:56 pm
You get the "squiggly" because your local cache is out-of-date (press Ctrl + Shift + R to refresh it). SSMS isn't yet aware of the recent changes...
Temp tables, CTE, Views - all would work well but it really depends on how large a data set we're talking about?
Would need to know more details to really help you out...
Can you post your queries, DDL to create the tables involved, and some sample data?
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply