|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
使用DBaaS能让收入损失从其他业务上得到弥补,如软件更新和硬件管理。也许决定走DBaaS之路的客户可能会跳过解决方案提供商,尽管这个决策看起来有点短视。技能
ThesehasbeenpickedupfromthreadwithinsqljunkiesForumshttp://www.sqljunkies.com
Problem
TheproblemisthatIneedtorounddifferently(byhalves)
Example:4.24roundsto4.00,but4.26roundsto4.50.
4.74roundsto4.50and4.76roundsto5.00
Solution
declare@tfloat
set@t=100.74
selectround(@t*2.0,0)/2
Problem
Imwritingafunctionthatneedstotakeinacommaseperatedlistandusitinawhereclause.Theselectwouldlooksomethinglikethis:
select*frompeoplewherefirstnamein(larry,curly,moe)
Solution
usenorthwind
go
declare@xVarvarchar(50)
set@xVar=anne,janet,nancy,andrew,robert
select*fromemployeeswhere@xVarlike%+firstname+%
Problem
Needasimplepagingsqlcommand
Solution
usenorthwind
go
select*fromproductsa
where(selectcount(*)fromproductsbwherea.productid>=b.productid)between15and16
Problem
Performcase-sensitivecomparisionwithinsqlstatementwithouthavingtousetheSETcommand
Solution
usenorhtwind
go
SELECT*FROMproductsASt1
WHEREt1.productnameCOLLATESQL_EBCDIC280_CP1_CS_AS=Chai
--executethiscommandtogetdifferentcollatenaming
--select*from::fn_helpcollations()
Problem
Howtocallastoredprocedurelocatedinadifferentserver
Solution
SETNOCOUNTON
usemaster
go
EXECsp_addlinkedserver172.16.0.22,NSqlServer
go
Execsp_link_publication@publisher=172.16.0.22,
@publisher_db=Northwind,
@publication=NorthWind,@security_mode=2,
@login=sa,@password=sa
go
EXEC[172.16.0.22].northwind.dbo.CustOrderHistALFKI
go
execsp_dropserver172.16.0.22,droplogins
GO
RDBMS并非没有局限性。它们难以扩展,需要大量的资源来配置和维护,比如时间、硬件和人力。同样,它们往往遵循峰值性能模型,这就要求系统按照峰值容量来配置可用性,而不考虑典型的数据使用情况。 |
|