×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

Use as many SPs as you can ( DB guys will be so happy that you use their junks :P)

1.Since it sits on the server and runs faster, you can use SP to handle complicated sql or sql with large chunk of data.

2. If you don't change(upgrade, downgrade, switch) the DB server very often, SP has more advantages.

3. It's sounds hard to write SP at first, but you will love it we you get use to it. Check the "sample" directory of DB and find some sample SP would be helpful.

4. Try not to put front end business logic into SP so that you might avoid frequently changes in SP.

Good Luck
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 大家认为用stored procedure的好处和缺陷在哪里?是不是用得越多越好啊? 当然, 偶自己的答案是否定的,欢迎发言,谢谢!
    说累了偶提供从中国来的茶。:))
    • 个人认为,只有当处理大量数据并产生少量结果时,SP才可以认为有些价值。
      • 好久不见。:))
    • stored procedure is compiled so it is faster than sql statement.you can add permission to stored procedure so it more secure.also it prevent from sql injection which also make it more secure....
      • 不错。:))
      • but stored procedure is less powerful than those high level language, certain things are very hard to do, and code is hard to read.
        however, if u use MS SQL server, the coming SQL yukon supports using C# to write stored procedure, even though i haven't seen it, it seems very promising.
        • 你标题上说的,偶太同意了,里面说的,没用过,是个好消息。
          • there is nothing wrong to use stored procedure with other language together.I only use stored procedure for db operation only, business logic is designed with other language such as C#
            • 100%同意。:))
            • 我觉得有些可以写进SP的尽量写进SP, 要该BUSINESS RULE的话, 更新SP就一瞬间的事, 可是那要更改中间TIRE就要重新编译, 发布啥的, 累。 不过SP在测试的时候有点麻烦
              • 可是那东西确实写起来不如其它高级语言方便,偶觉得business的东西还是分开。
    • 我喜欢用SP, 阿拉编的后台程序不见一个SQL, 但是有个问题是, SP可移植性差, 幸亏只用ORACLE,要不 SQL SERVER上转来穿去, 估计就废了。
      • 你居然是用甲骨文的,高!
        • 没办法, 早早就立志做烤古雪茄了 :)
    • 各位高手,请帮忙 #1765839
      • try this
        Set CustomerData = Robs.Execute("LookupCustomerByLastName " , LastNameFragement)
    • Use as many SPs as you can ( DB guys will be so happy that you use their junks :P)
      1.Since it sits on the server and runs faster, you can use SP to handle complicated sql or sql with large chunk of data.

      2. If you don't change(upgrade, downgrade, switch) the DB server very often, SP has more advantages.

      3. It's sounds hard to write SP at first, but you will love it we you get use to it. Check the "sample" directory of DB and find some sample SP would be helpful.

      4. Try not to put front end business logic into SP so that you might avoid frequently changes in SP.

      Good Luck
      • JJ是权威,在toronto吗?
    • It really depends. Case by case ...
    • Should be as few as possible. It is diffcult to maintain, not portable. Except in some case performance is more important.
    • 个人认为应该尽量少用SP。SP的优点是执行效率高,速度快;缺点是难移植,难维护。相对于居高不下的开发和维护成本,执行效率的考虑在硬件不断进步的条件下已经可以退到一个相对次要的位置了。
      • Agree.
    • 效率高;尽可能使数据层和程序代码分离。
    • 写的多可以显示水平高,老板刮目相看;让别人没法替代,就你一个人看得懂。
      • if i'm the manager, u will be fired first, too risky to keep going like this.
        • it's not something a successfully boss would do. this issue should be solved before you would have to fire somebody. hehe
          • i'm just joking here..:) anyway, bottom line is about attitude..