Question : Coldfusion - SQL syntax

Hello experts.
I'm using coldfusion server language and MSSQL.
The question is:
Can i have multiple uploads in one query?
Can f.e the following two queries in one?
<cfquery name="updateposition1" datasource="#request.dsn#">
UPDATE dbo.artikel
SET
art_subposition = <cfqueryparam cfsqltype="cf_sql_integer" value="0">,
art_position = <cfqueryparam cfsqltype="cf_sql_integer" value="0">
WHERE art_subposition > <cfqueryparam cfsqltype="cf_sql_integer" value="#form.rows_left#">
AND art_position = <cfqueryparam cfsqltype="cf_sql_integer" value="1">
</cfquery>
<cfquery name="updateposition2" datasource="#request.dsn#">
UPDATE dbo.artikel
SET
art_subposition = <cfqueryparam cfsqltype="cf_sql_integer" value="0">,
art_position = <cfqueryparam cfsqltype="cf_sql_integer" value="0">
WHERE art_subposition > <cfqueryparam cfsqltype="cf_sql_integer" value="#form.rows_right#">
AND art_position = <cfqueryparam cfsqltype="cf_sql_integer" value="2">
</cfquery>

Answer : Coldfusion - SQL syntax

Sure, just use an OR in the where clause...

 (Btw, I removed cfqueryparam for all your constants, there is not reason to bind variables when the value is a constant...)

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
<cfquery name="updateposition" datasource="#request.dsn#">
UPDATE dbo.artikel
SET art_subposition = 0
  , art_position = 0
WHERE 
  (art_subposition > <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.rows_right)#">
   AND art_position = 2
   )
or (art_subposition > <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.rows_left)#">
   AND art_position = 1
   )
</cfquery>
Random Solutions  
 
programming4us programming4us