如何更新文本文件中的数字?

时间:2017-04-28 15:55:35

标签: python

我保存到文本文件已经订购了多少食物,我总是需要更新号码,我该怎么做?它总是重置它......

我尝试了这个,但它没有工作:

create table #something
(
    FieldName varchar(25)
    , Before varchar(25)
    ,After varchar(25)
)

insert #something
select 'Category', 'lx', 'mt' union all
select 'AskingPrice', '9.50', '10.00' union all
select 'Name', 'Paul', 'Paula' union all
select 'AskingPrice', '7.20', '9.10' union all
select 'Category', 'za', 'pz';

with MyCte as
(
    select *
    from #something
    where FieldName = 'AskingPrice'
)

select *
from MyCte
where CONVERT(decimal(7, 2), After) > CONVERT(decimal(7, 2), Before);

0 个答案:

没有答案