Click here to Skip to main content
15,300,205 members
Home / Discussions / Database
   

Database

 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Jörgen Andersson25-Apr-18 2:15
professionalJörgen Andersson25-Apr-18 2:15 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton25-Apr-18 5:47
MemberJChrisCompton25-Apr-18 5:47 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Jörgen Andersson25-Apr-18 10:49
professionalJörgen Andersson25-Apr-18 10:49 
PraiseRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton26-Apr-18 4:17
MemberJChrisCompton26-Apr-18 4:17 
QuestionEXCEPTIONS INTO Equivalent for SQL Server Pin
User 1205041720-Apr-18 4:59
MemberUser 1205041720-Apr-18 4:59 
AnswerRe: EXCEPTIONS INTO Equivalent for SQL Server Pin
Eddy Vluggen23-Apr-18 5:21
professionalEddy Vluggen23-Apr-18 5:21 
GeneralRe: EXCEPTIONS INTO Equivalent for SQL Server Pin
User 1205041723-Apr-18 5:24
MemberUser 1205041723-Apr-18 5:24 
Questionhow to access temp table field in subquery? Pin
joost.versteegen11-Apr-18 21:43
Memberjoost.versteegen11-Apr-18 21:43 
hi,
I get an error :
The multi-part identifier "e.ent_name" could not be bound.
when trying to access a field from a temp table in a sub-query.

SQL
declare @entities table(ent_id int, ent_name varchar(50), startDT datetime)

insert into @entities
select ent.ent_id, ent_name, prod_job.act_start_time_local
from job as prod_job
inner join ent as ent on prod_job.run_ent_id = ent.parent_ent_id
where prod_job.wo_id = 'B.100077779'

select * from @entities -- so far so good

select * from @entities as e
inner join
(
    select top(1) act_finish_time_local, oper_id from job as cleaningJob
    where cleaningJob.oper_id like '%'+ e.ent_name +'%' ----> error
    order by act_finish_time_local desc
)
as j on j.act_finish_time_local < e.startDT


how can i fix this?
Thanks
AnswerRe: how to access temp table field in subquery? Pin
Victor Nijegorodov11-Apr-18 22:18
MemberVictor Nijegorodov11-Apr-18 22:18 
AnswerRe: how to access temp table field in subquery? Pin
Mycroft Holmes11-Apr-18 23:42
professionalMycroft Holmes11-Apr-18 23:42 
GeneralRe: how to access temp table field in subquery? Pin
joost.versteegen11-Apr-18 23:53
Memberjoost.versteegen11-Apr-18 23:53 
AnswerRe: how to access temp table field in subquery? Pin
Richard Deeming19-Apr-18 2:34
mveRichard Deeming19-Apr-18 2:34 
QuestionExporting Select statement values into csv with escape characters Pin
indian1439-Apr-18 12:16
Memberindian1439-Apr-18 12:16 
AnswerRe: Exporting Select statement values into csv with escape characters Pin
Victor Nijegorodov9-Apr-18 20:27
MemberVictor Nijegorodov9-Apr-18 20:27 
QuestionReading csv file data using selecte statement Pin
indian1439-Apr-18 6:50
Memberindian1439-Apr-18 6:50 
AnswerRe: Reading csv file data using selecte statement Pin
Victor Nijegorodov9-Apr-18 8:37
MemberVictor Nijegorodov9-Apr-18 8:37 
GeneralRe: Reading csv file data using select statement Pin
indian14311-Apr-18 9:18
Memberindian14311-Apr-18 9:18 
Questionwriting complex queries in Sql Pin
emilyz788-Apr-18 8:42
Memberemilyz788-Apr-18 8:42 
Questionwriting complex queries in Sql Pin
emilyz788-Apr-18 8:42
Memberemilyz788-Apr-18 8:42 
AnswerRe: writing complex queries in Sql Pin
Mycroft Holmes8-Apr-18 12:57
professionalMycroft Holmes8-Apr-18 12:57 
AnswerRe: writing complex queries in Sql Pin
CHill608-Apr-18 23:33
mveCHill608-Apr-18 23:33 
AnswerRe: writing complex queries in Sql Pin
Eddy Vluggen9-Apr-18 2:16
professionalEddy Vluggen9-Apr-18 2:16 
QuestionConfiguring multiple properties or values in SSIS Package using Package Configuration file Pin
indian1432-Apr-18 14:18
Memberindian1432-Apr-18 14:18 
QuestionTrying to insert values into Table Variable in Dynamic Sql Pin
indian1432-Apr-18 13:17
Memberindian1432-Apr-18 13:17 
AnswerRe: Trying to insert values into Table Variable in Dynamic Sql Pin
Mycroft Holmes2-Apr-18 14:22
professionalMycroft Holmes2-Apr-18 14:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.