日期:2014-05-20 浏览次数:20855 次
declare @i int
set @i=8
select CAST(@i as decimal) as result
select CAST(@i as decimal(10,2)) as result
select CAST(@i as decimal(10,4)) as result
/*
8
8.00
8.0000
*/
if OBJECT_ID('split_pages') is not null
drop table split_pages
GO
create table split_pages
(
ID int primary key,
Name varchar(100)
)
GO
declare @i int
set @i=1
while @i<=300
begin
insert into split_pages
select @i,'TEST' + CAST(@i as varchar(10))
set @i=@i+10
end
GO
select * from split_pages