• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

quick SQL question (simple homework)

iamme

Lifer
edit: another question:

i'm working with 1 table called POSTALCODE. i need to change the value of CCEXISTS to 'NO', if COMBOCODE is blank (null). the datatype of COMBOCODE is number. here's what i have:

UPDATE POSTALCODE SET CCEXISTS = 'NO'
WHERE COMBOCODE = Null ;

am i doing something wrong here?

------------------------------------------------------------------------------

i have a table where i'm trying to insert a new row and then display the "stateprovname" column to show that the table has been updated:

INSERT INTO STATEPROV
VALUES(1, 20, 120, 'ON', 'ONTARIO')
SELECT STATEPROVNAME
FROM STATEPROV;

when i try to save/run it,i get a "missing semicolon" error and the SELECT is highlighted. i've tried to put a semicolon after then VALUE(xxx) statement, but i get errors that way too. am i missing something simple?
 
Originally posted by: iamme
i have a table where i'm trying to insert a new row and then display the "stateprovname" column to show that the table has been updated:

INSERT INTO STATEPROV
VALUES(1, 20, 120, 'ON', 'ONTARIO')
SELECT STATEPROVNAME
FROM STATEPROV;

when i try to save/run it,i get a "missing semicolon" error and the SELECT is highlighted. i've tried to put a semicolon after then VALUE(xxx) statement, but i get errors that way too. am i missing something simple?

INSERT INTO STATEPROV
VALUES(1, 20, 120, 'ON', 'ONTARIO');

SELECT STATEPROVNAME
FROM STATEPROV;

Two different SQL statements
 
oh, so in ms access, i need to setup two seperate queries?

edit: looks like that's the case. thanks 😀
 
*slaps forehead*

that works 😀

before it wasn't giving me an error, it just wasn't updating anything.

thanks for your help!
 
Originally posted by: iamme
edit: another question:

i'm working with 1 table called POSTALCODE. i need to change the value of CCEXISTS to 'NO', if COMBOCODE is blank (null). the datatype of COMBOCODE is number. here's what i have:

UPDATE POSTALCODE SET CCEXISTS = 'NO'
WHERE COMBOCODE = Null ;

am i doing something wrong here?

WHERE COMBOCODE IS NULL

NULL is not comparable.
 
Originally posted by: KnightBreed
Originally posted by: iamme
bump for another question 😱
Are you getting an error or is the update simply not doing anything.

Try:

UPDATE POSTALCODE
SET CCEXISTS = 'NO'
WHERE COMBOCODE Is Null ;


This is correct, comparisons against null in SQL is done through "IS NULL" or "IS NOT NULL" it doesn't follow the standard value = new value

--Mark
 
Back
Top