1
Answer

How to use insert and select statement to fill a table

Dear Code Masters,
I believe all you you are doing fine and in good health.
 
i want to insert some record from table "REGIMEN" to table "Common_HIVQ" and i use the statement  below :
 
  1. INSERT INTO  Common_HIVQ (PatientIdentifier,VisitID,VisitDate,code14,codedesctxt15)    
  2. SELECT patientIdentifier,visitid32,visitdate33,code34,codedesctxt35 FROM Regimen WHERE VisitDate33 <> Common_HIVQ.VisitDate  
but i get the following error "
Msg 4104, Level 16, State 1, Line 3
The multi-part identifier "Common_HIVQ.VisitDate" could not be bound.
"
please i have done every thing to correct this error but to no result. Kindly help me
 

Answers (1)

0
Photo of Gautam Parmar
NA 872 2.2k 7y
Use a boolean field for status of delete yes or no
Accepted
0
Photo of Prem Sahani
NA 85 1.8k 7y
i have one simple program , suppose, one building is there,  have some facility, like Video Game, restuarents  elc..
when some one using those facility  so we can't delete from table...
 
thank you bro
0
Photo of Gautam Parmar
NA 872 2.2k 7y
While user delete row in store procedure update that row into isdeleted=1
 
and retriving data stored procedure will be select * Record where isDeleted=0
0
Photo of Tapan Patel
NA 8.1k 101k 7y
Please explain little bit about what do you mean by table value and what is your expected output?