Hi,
I need help with a SQL statement that combines a select and an insert or update statement all in one swoop. I see others that breaks it into 3 statements as in 1. select(to find), 2. delete, and 3. re-insert. I personally want to do only whats needed. Here is the flow:
1. select statement that will determine if the record exists,
2. if exists, then do a SQL update,
3. if not exists, do an insert,
Thats it...
I will load all the values up front while constructing the statement, so that it has all the values it needs whether its inserting or updating.
I'm working in Visual Foxpro, and while looping thru its records i'm creating a sql script that will be passed to sql server one at a time. Its that the script must contain everything that sql will need before allowing VFP to move to the next record...
Thanks, Stanley
I need help with a SQL statement that combines a select and an insert or update statement all in one swoop. I see others that breaks it into 3 statements as in 1. select(to find), 2. delete, and 3. re-insert. I personally want to do only whats needed. Here is the flow:
1. select statement that will determine if the record exists,
2. if exists, then do a SQL update,
3. if not exists, do an insert,
Thats it...
I will load all the values up front while constructing the statement, so that it has all the values it needs whether its inserting or updating.
I'm working in Visual Foxpro, and while looping thru its records i'm creating a sql script that will be passed to sql server one at a time. Its that the script must contain everything that sql will need before allowing VFP to move to the next record...
Thanks, Stanley