|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
STORED PROC WITH <> AND MULTIPLE ORS
I need to create a SQL Server Stored Proc that will handle a variable number of Or conditions. This is currently being done with a MS Access Query as follows
Do Until rst.EOF myw = myw = "(rst!Field1 <> 0) OR (rst!Field1 <> 1) " Loop mysql = "UPDATE Table SET Field2 = 1 WHERE " & myw The above code is very simplified. I Want to create a stored proc to do this but I cannot send it the SQL to the Stored Proc (or can I) so I need to use parameters instead. I want to do something like Do until rst.EOF Set cmd = MakeStoredProc("sp_Table_UpdateField2_ForField1") Set prmField1 = cmd.CreateParameter("Field1", adInteger, adParamInput, , rst!Field2) cmd.Parameters.Append Field1 cmd.Execute Loop Again the above is very simplified. So how can you get the the SQL for the Stored Proc for something like the following from a loop WHERE = (Field1 <> 0) OR (Field1 <> 1) OR (Field1 <> 2) ... Thanks in advance for your help |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > STORED PROC WITH <> AND MULTIPLE ORS |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|