关闭

【数据库SQL】将小写修改为大写

236人阅读 评论(0) 收藏 举报
分类:
use hbposev9
go
delete from pbcatcol where pbc_tnam = 't_bd_item_info2'
go
delete from pbcatcol where pbc_tnam = 't_pc_branch_price2'
go
--将货号中存在小写的字母修改成大写
declare @ls_tablename varchar(50),@ls_sql varchar(500)
declare test_cur cursor for
SELECT pbc_tnam
        FROM pbcatcol 
        WHERE pbc_cnam = 'item_no'
        ORDER BY pbc_tnam  
        for read only
open test_cur
fetch test_cur into @ls_tablename;
while @@fetch_Status = 0
begin
set @ls_sql='update' +'  '  +@ls_tablename+'   set item_no=upper(item_no)'
exec( @ls_sql)
fetch test_cur into @ls_tablename;
end
close test_cur
deallocate test_cur
go


--将机构号中存在小写的字母修改成大写
declare @ls_tablename varchar(50),@ls_sql varchar(500)
declare test_cur cursor for
SELECT pbc_tnam
        FROM pbcatcol 
        WHERE pbc_cnam = 'branch_no'
        ORDER BY pbc_tnam  
        for read only
open test_cur
fetch test_cur into @ls_tablename;
while @@fetch_Status = 0
begin
set @ls_sql='update' +'  '  +@ls_tablename+'   set branch_no=upper(branch_no)'
exec( @ls_sql)
fetch test_cur into @ls_tablename;
end
close test_cur
deallocate test_cur
go


--将会员卡号中存在小写的字母修改成大写
declare @ls_tablename varchar(50),@ls_sql varchar(500)
declare test_cur cursor for
SELECT pbc_tnam
        FROM pbcatcol 
        WHERE pbc_cnam = 'card_id'
        ORDER BY pbc_tnam  
        for read only
open test_cur
fetch test_cur into @ls_tablename;
while @@fetch_Status = 0
begin
set @ls_sql='update' +'  '  +@ls_tablename+'   set card_id=upper(card_id)'
exec( @ls_sql)
fetch test_cur into @ls_tablename;
end
close test_cur
deallocate test_cur
go
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:19781次
    • 积分:1127
    • 等级:
    • 排名:千里之外
    • 原创:98篇
    • 转载:1篇
    • 译文:0篇
    • 评论:1条