[root@testlihb ~]# su - mysql
-bash-4.1$ mysql -uroot -p********* -h127.0.0.1 -P3306
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use test
Database changed
mysql> create table t ( a int,b int);
Query OK, 0 rows affected (0.65 sec)
mysql> insert into t values (1,null);
Query OK, 1 row affected (0.09 sec)
mysql> insert into t values (null,1);
Query OK, 1 row affected (0.10 sec)
mysql> select * from t;
+------+------+
| a | b |
+------+------+
| 1 | NULL |
| NULL | 1 |
+------+------+
2 rows in set (0.00 sec)
mysql>
mysql> select ifnull(a,'') as a,ifnull(b,'') as b from t into outfile '/tmp/t.txt';
Query OK, 2 rows affected (0.00 sec)
mysql>
mysql>
mysql> ^DBye
-bash-4.1$
-bash-4.1$
-bash-4.1$ id
uid=27(mysql) gid=27(mysql) groups=27(mysql)
-bash-4.1$ logout
[root@testlihb ~]# su - sybase
[sybase@testlihb ~]$ isql -Usa -P**** -SASE -w999
1> use tempdb
2> go
1> create table t (a int null,b int null)
2> go
1> select * from tempdb..t
2> go
a b
----------- -----------
(0 rows affected)
[sybase@testlihb ~]$ bcp tempdb..t in /tmp/t.txt -Usa -SASE -P***** -c
Starting copy...
2 rows copied.
Clock Time (ms.): total = 117 Avg = 58 (17.09 rows per sec.)
[sybase@testlihb ~]$
[sybase@testlihb ~]$ isql -Usa -P***** -SASE -w999
1> select * from tempdb..t
2> go
a b
----------- -----------
1 NULL
NULL 1
(2 rows affected)
1>
2> select * from tempdb..t where b is null
3> go
a b
----------- -----------
1 NULL
(1 row affected)
1>
-bash-4.1$ mysql -uroot -p********* -h127.0.0.1 -P3306
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use test
Database changed
mysql> create table t ( a int,b int);
Query OK, 0 rows affected (0.65 sec)
mysql> insert into t values (1,null);
Query OK, 1 row affected (0.09 sec)
mysql> insert into t values (null,1);
Query OK, 1 row affected (0.10 sec)
mysql> select * from t;
+------+------+
| a | b |
+------+------+
| 1 | NULL |
| NULL | 1 |
+------+------+
2 rows in set (0.00 sec)
mysql>
mysql> select ifnull(a,'') as a,ifnull(b,'') as b from t into outfile '/tmp/t.txt';
Query OK, 2 rows affected (0.00 sec)
mysql>
mysql>
mysql> ^DBye
-bash-4.1$
-bash-4.1$
-bash-4.1$ id
uid=27(mysql) gid=27(mysql) groups=27(mysql)
-bash-4.1$ logout
[root@testlihb ~]# su - sybase
[sybase@testlihb ~]$ isql -Usa -P**** -SASE -w999
1> use tempdb
2> go
1> create table t (a int null,b int null)
2> go
1> select * from tempdb..t
2> go
a b
----------- -----------
(0 rows affected)
[sybase@testlihb ~]$ bcp tempdb..t in /tmp/t.txt -Usa -SASE -P***** -c
Starting copy...
2 rows copied.
Clock Time (ms.): total = 117 Avg = 58 (17.09 rows per sec.)
[sybase@testlihb ~]$
[sybase@testlihb ~]$ isql -Usa -P***** -SASE -w999
1> select * from tempdb..t
2> go
a b
----------- -----------
1 NULL
NULL 1
(2 rows affected)
1>
2> select * from tempdb..t where b is null
3> go
a b
----------- -----------
1 NULL
(1 row affected)
1>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31441616/viewspace-2152523/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31441616/viewspace-2152523/