数据库字符集

每种不同的数据库的字符集的查询不同。

mysql:
sql = "SELECT  DEFAULT_CHARACTER_SET_NAME AS ENCODING FROM  SCHEMATA WHERE SCHEMA_NAME='"+dbName+"'";

sqlserver:
sql = "SELECT ATTRIBUTE_VALUE AS ENCODING FROM MASTER.DBO.SPT_SERVER_INFO WHERE ATTRIBUTE_NAME='COLLATION_SEQ'";


oracle:
sql = "SELECT VALUE AS ENCODING FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_CHARACTERSET'";
sybase:
sql = "SELECT name AS ENCODING FROM master.dbo.syscharsets WHERE status=1";

db2:




数据库中表特别多,包括系统表等,oracle表和视图可以用下面方式查询。

select * from all_tables where table_name=UPPER('NLS_DATABASE_PARAMETERS')

select * from all_views where view_name=UPPER('NLS_DATABASE_PARAMETERS')

你可能感兴趣的:(oracle,sql,SQL Server,db2,Sybase)