| |

VerySource

 Forgot password?
 Register
Search
View: 1144|Reply: 5

Find a query code for sql querying empty fields

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-6 18:00:01
| Show all posts |Read mode
Access was used more than a year ago.At that time, several fields were established in the database for future upgrades.
These four fields of ABCD were not used at the time, so the code of these fields was not written when writing the data. Now, these fields need to be enabled because of the upgrade. An error will occur because the record is empty. So at the beginning of the program, add the following code,

sql_.Format ("select * from customer management where IsNull [A]");
_bstr_t sql = sql_;
theApp.m_pRs = theApp.m_pCon-> Execute (sql, NULL, adCmdText);
while (! theApp.m_pRs-> adoEOF)
{
theApp.m_pRs-> Fields-> GetItem ("a")-> PutValue ("");
theApp.m_pRs-> Fields-> GetItem ("b")-> PutValue ("");
theApp.m_pRs-> Fields-> GetItem ("c")-> PutValue ("");
theApp.m_pRs-> Fields-> GetItem ("d")-> PutValue ("");
theApp.m_pRs-> Fields-> GetItem ("e")-> PutValue (renshishijian1);
// theApp.m_pRs-> Update ();
theApp.m_pRs-> MoveNext ();
}
But the SQL statement was not written correctly, and no relevant code was found on the Internet.
sql_.Format ("select * from customer management where A IsNull"); It is not correct to write this, please enlighten.
Reply

Use magic Report

0

Threads

20

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-1-14 20:09:01
| Show all posts
select * from customer management where A Is Null
or
select * from customer management where A = ""
Reply

Use magic Report

0

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-17 23:45:01
| Show all posts
select * from customer management where A Is Null
Reply

Use magic Report

0

Threads

23

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-1-17 23:54:01
| Show all posts
select * from customer management where IsNull (A)
Reply

Use magic Report

0

Threads

11

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-2-16 14:15:01
| Show all posts
First determine if it is empty OR NULL?
NULL
select * from customer management where IsNull (A)
air
select * from customer management where LEN (TRIM (A)) = 0
Reply

Use magic Report

0

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-6-1 13:30:01
| Show all posts
select * from customer management where [a] is null or [a] = '' "
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list