您现在的位置是: IT外包 ->数据存储 ->sybase3 ->
 
本文关键字: 使用动态SQL(ASE12.0+)
Google
 
使用动态SQL(ASE12.0+)
作者: 不详 | 发布时间: 2007-08-03 09:52 | 信息类别: sybase3 | 访问人次:
评论 推荐 打印 编辑 】 【 关闭
  

  
使用动态SQL(ASE12.0+)




With a certain regularity, Sybase users ask questions like "How can I use dynamic SQL in ASE ?" in the Sybase-related newsgroups. There are a number of different answers to this question.

The elegant way: execute-immediate (ASE 12.0+)
First, if you're running ASE 12.0 or later, you can use the execute immediate feature, which gives you full dynamic SQL capabilites, as it lets you execute dynamically generated SQL command strings. A simple example:

declare @c varchar(25)

select @c = "select getdate()"

exec (@c)


While this example is hardly something to get excited about, execute-immediate has opened a new dimension to the sort of thing you can do with T-SQL. The most important characteristic is that you can now create stored procedures (and triggers) that are independent of the schema of tables -- a highly useful thing to do.
My book "Tips, Tricks & Recipes for Sybase ASE" has a chapter dedicated to execute-immediate, describing not only the inner workings, but also a wide range of possible applications. This is probably the most complete writeup about execute-immediate that's available.
评论 推荐 打印 编辑 】 【 关闭
『相关链接』
序号
标题 发布日期
1
2007-01-25 15:15:36
【郑重声明】【上海IT外包服务网】 刊载此文不代表同意其说法或描述,仅为提供更多信息,也不构成任何投资或其他建议。转载需经作者本人同意并注明出处。本网站有部分文章是由网友自由上传。对于此类文章本站仅提供交流平台,不为其版权负责。如果您发现本网站上有侵犯您的知识产权的文章,请发信至 或直接电话联系: 021-58879030
请您留言
『发表评论』
匿名发表 会员ID: 密码:

上海蝶应信息科技有限公司
上海市商城路341号紫光大厦1305室 +0086-21-58878998 11394019
dieying@541help.com +0086-21-58879030HappyFreeAngel@hotmail.com
Copyright@2007 IT-WAIBAO.COM Inc.沪ICP备05039378号 版权所有2007-2010 管理员登陆