View Full Version: Sql Server Update Syntax To Remove Item

LawsonTalk > Database > Sql Server Update Syntax To Remove Item



Title: Sql Server Update Syntax To Remove Item
Description: sql server update syntax to remove item


bgodwin - April 23, 2007 10:28 PM (GMT)
trying to remove the 2 in the coloumn for lp140 in the prmonitor table and sql server does not allow nulls...i'm not sure if I'm supposed to put a space in there or not

here is what I was trying to do

update lawson.PRMONITOR set LP140_RUN_FLG = null

mnye - April 24, 2007 06:15 PM (GMT)
first off you realize that statement will update EVERY record in the table? Secondly, if you are trying to set all records to be "No Cycle" you want it to be a space, you can use the following statement:

UPDATE lawson.PRMONITOR
SET LP140_RUN_FLG = SPACE(1)

If that doesnt work use:

UPDATE lawson.PRMONITOR
SET LP140_RUN_FLG = ' '


I liek the first because it is far more clean, but the second does the same thing.


hth,
matt

bgodwin - April 24, 2007 09:09 PM (GMT)
We ended up letting lawson gsc do something to clear out the 2's in every record..I think he did a table dump or something.

Thanks for the info...i was curious though if putting a space would create an issue..when the field is supposed to be blank (i.e. no space)

mnye - April 24, 2007 09:50 PM (GMT)
If you check out the Data Text File for PR system, look up the PRMONITOR table. for the LP140-RUN-FLG, a space is a valid value that equates to "No cycle".




Hosted for free by InvisionFree