SQL如何生成漢字列表


use testdb

create table a(id int)

declare @i int
declare @n int
set @i = 1
set @n = 176
while (@i <= 71)
begin

 insert a values(@n)
 set @i = @i + 1 
 set @n = @n+1
end

select * from a

create table b(id int)

declare @i int
declare @n int
set @i = 1
set @n = 161
while (@i <= 94)
begin

 insert b values(@n)
 set @i = @i + 1 
 set @n = @n+1
end

select * from b

 

select count(*)
from (

select a.id as aid,cast(a.id as binary(1)) as abinary,b.id as bid,cast(b.id as binary(1)) as bbinary,
a.id+b.id as absum,
cast((cast(a.id as binary(1))+cast(b.id as binary(1))) as binary(2)) as prcch,

cast((cast(a.id as binary(1))+cast(b.id as binary(1))) as char(2)) as ch
from a,b

where
not(
a.id = 215 and b.id between 250 and 254
)

) as t


create table ab
(
aid int,
abinary binary(1),
bid int,
bbinary binary(1),
absum int,
prcch binary(2),
ch char(2)
)

 

 

select * from ab

發佈了31 篇原創文章 · 獲贊 0 · 訪問量 8萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章