I've gotten to the point where the script is finished for importing data for a single user, however that I want to extend to all users now.
A statement I currently have is the following: Now what I want is to use the enrollment dates from all users (so I would omit the "WHERE auto_patient_id ..." statement) and insert them into all corresponding rows. I tried for two users at once with the statement However this gave me an error that said "Query returned multiple rows", referring to the inner query of SELECT Date_Enrollment.
If it is not possible can you show me how to write "GOOD" sql ? i.e, one column of a table should get updated from another column of another table.
The CTE result set is derived from a simple query and is referenced by UPDATE statement.
Common table expressions can also be used with the SELECT, INSERT, DELETE, and CREATE VIEW statements. For information about table hints, see , 'expression' should be prefixed with the capital letter 'N'.
Parameterized Queries are my preferred way of going.
I'm using MS-SQL Server 2005 EDIT: Closing, and re-asking as EDIT: Re-opened, as this appears to be a popular question // make one of these for each row String.