unissoft-bj / TMK

TeleMarketing Integration
1 stars 0 forks source link

SAP 数据库处理中文字符的问题 #9

Open unissoft-bj opened 8 years ago

unissoft-bj commented 8 years ago

declare @lname as varchar(10); select @lname = u_name from ousr where fax='229'; select @lname;

/* not work _/ select userid,user_code,u_name from ousr where uname = @lname; select slpcode,slpname from oslp where slpname = @lname; / work */ select userid,user_code,u_name from ousr where u_name = (select u_name from ousr where fax='229'); select slpcode,slpname from oslp where slpname = (select u_name from ousr where fax='229');

改进的逻辑:

1, slpcode 初始值 ‘-1’,userid初始值 ‘NULL' 2,在sap 用户设置 界面的传真fax字段,指定user的分机号码(229) 3,根据 分机号码,在sap数据库中查询 userid 和 slpcode (代替之前的根据名字查询) select top 1 userid from ousr where locked='N' and fax='229' order by userid desc; select top 1 slpcode from oslp where slpname = (select top 1 u_name from ousr where locked='N' and fax='229' order by userid desc); 4,如果查不到userid,则保持’NULL‘(空值) 如果查不到slpcode,则保持’-1‘(无销售人员)

unissoft-bj commented 8 years ago

在SAP数据库中创建schema_version

drop table schema_version;

create table schema_version( version_rank int,
installed_rank int,
version varchar(50),
description varchar(200),
type varchar(20),
script varchar(1000),
checksum int,
installed_by varchar(100),
installed_on timestamp,
execution_time int,
success tinyint );

insert into schema_version (version_rank, installed_rank, version, description, type, script, checksum ,installed_by, execution_time, success) values( '1','1','1438645918','PRIMARYMODEL','SQL','V1438645918__PRIMARY_MODEL.sql','1317770571','root','131','1' );

insert into schema_version (version_rank, installed_rank, version, description, type, script, checksum ,installed_by, execution_time, success) values( '2','2','1438824220','PRIMARYMODELINSERT','SQL','V1438824220__PRIMARY_MODEL_INSERT.sql','727308122','root','4','1' );

insert into schema_version (version_rank, installed_rank, version, description, type, script, checksum ,installed_by, execution_time, success) values( '3','3','1438834228','PRIMARYMODELINSERT','SQL','V1438834228__PRIMARY_MODEL_INSERT.sql','1555829380','root','123','1' );