Question
sql insert question
I am trying to do a simple insert :
<cfquery name="qryInsert" datasource="dbName">
insert into table
(primaryID,
partNumber,
txnDate
quantity,
lineItem)
values(
'#primaryID#',
'#form.partNumer#',
'#form.txnDate#',
'#form.quantity#".
'#form.lineItem#')
</cfquery>
What I want/need to do is to check to see if the lineItem is aleady in the table. If it is there, then that record will not be inserted. If the line item is not in the table, then insert the record.
What is the propery sql syntax to check for this, and where would it go, inside this query/insert ?
<cfquery name="qryInsert" datasource="dbName">
insert into table
(primaryID,
partNumber,
txnDate
quantity,
lineItem)
values(
'#primaryID#',
'#form.partNumer#',
'#form.txnDate#',
'#form.quantity#".
'#form.lineItem#')
</cfquery>
What I want/need to do is to check to see if the lineItem is aleady in the table. If it is there, then that record will not be inserted. If the line item is not in the table, then insert the record.
What is the propery sql syntax to check for this, and where would it go, inside this query/insert ?
