菜鸟求SQL语句 - MS-SQL Server / 疑难问题
想在PE_CommonModel表的Hits字段填入8000-20000的随机数字。并替换原来的数字
求SQL语句,数据库是SQLSERVER
select ceiling (rand()*(20000-8000)+8000)
SQL code:
update tb set col=ceiling (rand()*(20000-8000)+8000)
SQL code:
update tb set col=(cast(ceiling (rand()*(20000-8000)+8000) as int)
SQL code:
declare @t table(id int)
insert @t select 1
insert @t select 2
insert @t select 3
update @t set id=2000+rand(checksum(newid()))*(8000-2000)
select * from @t
/*
id
-----------
6807
6607
2054
*/
update @t set id=ceiling (rand()*(20000-8000)+8000)
select * from @t
/*
id
-----------
18878
18878
18878
*/
SQL code:
select cast(ceiling (rand()*(20000-8000)+8000) as int)
/*-----------
14423
(1 行受影响)
*/
相关问答:
可能因为工作的原因 接触数据库这块比较少,之前都是做程序这块,数据库这块都有专门的人来做 分工都很明细 所以对数据库这一块完全不了解。前段时间 去面试了几家公司 几乎都是在数据库这块挂掉的 连个简单的SQ ......
如何在SQL2005中设定定时作业,比如说定时清理某些表的数据,
或者是定时的将某些表的数据导出excel!
在线等待,急急急,最好是详细步骤!
之前我做的作业有点问题!
帮UP
参考:http://hi.baidu.com/toiota ......
tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......
1。怎样使xp_cmdshell能完整输出超过255个字符的字符串。
2。select 时,检索速度是与from后的 TABLE顺序有关,还是与where条件的顺序有关(TABLE数据多少 )
在系统属性设定里有个选项,可以修改单字段输出字数限制. ......
id url rank ......