mssql 에서 intersect 가 지원이 안되서 아래와 같이 구현 하였습니다.
여기서 #intersect 에 결과가 저장 되는데....
use tempdb go
if exists(select * from sysobjects where xtype = 'u' and name like '#intersect%') drop table #intersect
go
use ultralra
select doc.doc_id, doc.title, doc.pos into #intersect from Bagword, doc, term where doc.doc_id = Bagword.doc_id and Bagword.term_id = term.term_id and term.term like '%전자정보%' go
delete from #intersect where doc_id not in (select doc.doc_id from Bagword, doc, term where doc.doc_id = Bagword.doc_id and Bagword.term_id = term.term_id and term.term like '%전북대학교%') go
(select doc.doc_id, doc.title, doc.pos from Bagword, doc, term where doc.doc_id = Bagword.doc_id and Bagword.term_id = term.term_id and term.term like '%전자정보%')
(select doc.doc_id, doc.title, doc.pos from Bagword, doc, term where doc.doc_id = Bagword.doc_id and Bagword.term_id = term.term_id and term.term like '%전북대학교%')
select * from #intersect
이것을 asp.net 에서 사용하는데. 계속 에러가 뜨네요....
아시는분 답변좀 제발 plz
에러는
[SqlException: 개체 이름 '##intersect'이(가) 잘못되었습니다.] System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +179 ASP.output_aspx.DataLoading() in C:\Inetpub\wwwroot\ultralra\output.aspx:85 ASP.output_aspx.Page_Load(Object Src, EventArgs E) in C:\Inetpub\wwwroot\ultralra\output.aspx:26 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731
이고요 에라 코드는
sqlS = "delete from ##intersect where doc_id not in (select doc.doc_id from Bagword, doc, term where doc.doc_id = Bagword.doc_id and Bagword.term_id = term.term_id and term.term like '%" + s + "%')"; myCommandCount = new SqlCommand(sqlS, myConnection); myConnection.Open(); myCommandCount.ExecuteNonQuery(); myConnection.Close();
입니다.
|