update query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

what is the difference between "not like" and " is not"

Could anyone tell me what is wrong with this query.

UPDATE table1 AS table1 SET table1.field1 = table1. field2 WHERE
table1.field2 is not null

how come it ask me input table1. field2 value to run the query?
 
-----Original Message-----
what is the difference between "not like" and " is not"

Could anyone tell me what is wrong with this query.

UPDATE table1 AS table1 SET table1.field1 = table1. field2 WHERE
table1.field2 is not null

how come it ask me input table1. field2 value to run the query?
.
1) use "AS" in a query to abbreviate the name of a table.
e.g. UPDATE table1 AS t1 ... (if you are not abbreviating
the name, then leave the "AS" off.)

2) is there a 'field2' in your table1 ?? make sure it is
spelled exactly the same in both the table and the query

3) if #2 isn't the problem then try surrounding the
field/table names with []. e.g. [table1].[field2]

4) storing redundant data is seldom needed. by updating
your field1 with the contents of field2, you are storing
the same data twice.

HTH
 
what is the difference between "not like" and " is not"

The LIKE operator recognizes wildcards (for example # matches any
numeric digit, * matches any string). So a criterion

LIKE "a*c"

will match any string which starts with a and ends with c.

NOT LIKE "a*c"

will match any string UNLESS it starts with a and ends with c.

IS NOT is valid only in the context IS NOT NULL and will return the
record if there is any value whatsoever in the field.
Could anyone tell me what is wrong with this query.

UPDATE table1 AS table1 SET table1.field1 = table1. field2 WHERE
table1.field2 is not null

how come it ask me input table1. field2 value to run the query?

Probably because you have an extra blank between table1. and field2.
Is there in fact a field named Field2 in your query?

Also, the AS table1 clause is not necessary - you're just defining
"table1" as an alias for "table1", which would be a bit like John
Dillinger calling himself John Dillinger to conceal his identity!

Try

UPDATE Table1
SET Field1 = Field2
WHERE Field2 IS NOT NULL;

Assuming that you have both fields in the table, this should replace
the current contents of Field1 with the value in Field2; if Field2 has
nothing in it, Field1 will be left untouched.

John W. Vinson[MVP]
(no longer chatting for now)
 
Back
Top