Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing more sql commands

Status
Not open for further replies.

wmbb

Technical User
Jul 17, 2005
320
NL
I want to execute several sql commands after each other.

Code:
UPDATE CLIENTS SET CLIENTS.XDEPTID = 1085, CLIENTS.XDEPTNR = 88513, CLIENTS.POB = 921
WHERE (((CLIENTS.XDEPTID)=921) AND ((CLIENTS.XDEL) Is Null Or (CLIENTS.XDEL)='N'));
UPDATE CLIENTS SET CLIENTS.XDEPTID = 1086, CLIENTS.XDEPTNR = 88520, CLIENTS.POB = 894
WHERE (((CLIENTS.XDEPTID)=894) AND ((CLIENTS.XDEL) Is Null Or (CLIENTS.XDEL)='N'));

but executing this part I get an error:
[Microsoft][ODBC SQL Server Driver]Function sequence error"

I don't know much about sql but can somebody help me with this problem ?
 
Maybe the removal of a few brackets might help ? Not 100% sure - because I don't know what client is being used to execute the code; this solution has not been tested.

UPDATE CLIENTS SET CLIENTS.XDEPTID = 1085, CLIENTS.XDEPTNR = 88513, CLIENTS.POB = 921 WHERE (CLIENTS.XDEPTID=921 AND (CLIENTS.XDEL Is Null Or CLIENTS.XDEL='N'));
UPDATE CLIENTS SET CLIENTS.XDEPTID = 1086, CLIENTS.XDEPTNR = 88520, CLIENTS.POB = 894
WHERE (CLIENTS.XDEPTID=894 AND (CLIENTS.XDEL Is Null Or CLIENTS.XDEL='N'));

Note that this...

(CLIENTS.XDEL Is Null Or CLIENTS.XDEL='N')

...can be reduced to...

ISNULL(CLIENTS.XDEL,'N')='N'

best wishes
 
Oops, sorry, forgot which forum I was in!

Replace 'ISNULL' with 'COALESCE' in the previous post
 
Please ignore my previous two posts, it's not an SQL problem and I shouldn't have treated it as such.

This question needs to be posed in some other forum, depending upon what client you are using to issue these statements against SQL Server. Once again my apologies for wasting your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top