Map<String, Schema.SObjectType> m = Schema.getGlobalDescribe() ;
Schema.SObjectType s = m.get('Account') ;
Schema.DescribeSObjectResult r = s.getDescribe() ;
String keyPrefix = r.getKeyPrefix();
System.debug(keyPrefix);
转载于:https://my.oschina.net/SpringZhang/blog/3017606