e股脑电脑教程网
  • 首 页
  • 操作系统
  • 应用软件
  • 下载工具
  • 影音视频
  • 办公软件
  • 媒体制作
  • 网站建设
  • 平面设计
  • 数据库
  • 程序开发
  • 视频教程
编辑推荐: | 文章搜索:
您现在的位置: e股脑 >> 数据库 >> Sybase教程 >> 通过CIS模拟动态sql(ASE 11.5 or 11.9) >> 教程正文
 
教程搜索
 
 
相关教程
  • Sybase数据库简介
  • 为什么有时候数据库事务日志满了,不能
  • 在LINUX下安装 Sybase ASE 11.0.3.3
  • Dealing with identity gaps (Freebo
  • 关于sybase数据库的锁
  • SYBASE内存和缓冲区管理(rekcah0)
  • sybase 临时数据库tempdb (Arnold)
  • SYBASE dbccdb的安装配置攻略
  • 从数据库应用系统查找解决阻塞问题
  • Sybase数据库的碎片整理( arnold )
  • SYBASE数据库用户管理基本概念 (howto
  • sybase 珍藏系列之三(from shanhan)
  • sybase 珍藏系列之四(from shanhan)
  • SYBASE补丁安装指南
  • 解决 Error 605 错误的方案
  • Sybase TraceFlag 定义
 
 

图文教程


  • Windows抢了谁的饭碗 非主流操作系统To

  • 地球还是火星 平常心看“非主流”

  • 综合运用Office 2007批量制作奖状

  • 没有系统盘如何才能修复受损系统?

  • 巧妙运用Excel中边界的附加功能!
 
 
赞 助 商
 
 
通过CIS模拟动态sql(ASE 11.5 or 11.9)
  • 来源:e股脑
  • 点击次数:
  • 更新时间:2007-8-9

Simulating dynamic SQL through CIS This is a demo of how you can use certain CIS (Component Integration Services) features in ASE 11.5 or 11.9 to simulate dynamic SQL.

ASE 12.0 contains a new feature called execute immediate which lets you execute a text string containing dynamically created SQL queries; however, this isn't possible in ASE 11.5.x or 11.9.x. This demo shows how to achieve basically the same functionality in ASE 11.5.x / 11.9.x.

Below on this page, you can download SQL scripts which will create a stored procedure named sp_exec_dynsql. This procedure takes a text string as an argument and executes the SQL statements contained in the text string. Here's an example: the below procedure myproc takes two arguments, being a column name and a table name. It will then select the specified column from the specified table using sp_exec_dynsql:

create procedure myproc @col_name varchar(32), @tab_name varchar(70) as begin declare @cmd varchar(255) select @cmd = "select " + @col_name + "from " + @tab_name exec sp_exec_dynsql @cmd end You can then do things like: 1> exec myproc "pub_name", "pubs2..publishers" 2> go pub_name ---------------------------------------- New Age Books Binnet & Hardley Algodata Infosystems (3 rows affected) Behind the scenes, this works as follows: using a CIS-related trick, you can access the local server as if it were a remote server. You can then use sp_remotesql to execute any command string in that not-so-remote server. Because sp_remotesql takes a text string as an argument, you can create any SQL statement dynamically and then execute it.


Note that you must be running ASE 11.5 or later (earlier versions do not have the CIS functionality included), and you must run set up the server for these tricks to work.

Note that there are also some other tricks to simulate dynamic SQL which will work in any ASE version, including versions 4.x, 10 and 11.0: go here to find out how to use it.

Installation instructions

  • Download everything you need here.
  • Now you should run two setup scripts to prepare your server for using CIS: run CISXP_SETUP1.SQL, restart your server and then run CISXP_SETUP2.SQL. Note that you should ensure your @@servername matches your servername in the interfaces file.
  • Next, you can run the script SP_EXEC_DYNSQL.SQL, and then finally you're ready to execute the procedure sp_exec_dynsql.
  • Lastly, you should be aware of some limitations and potential problems related to these tricks: follow this link for more info.


  • 上一篇教程: 使用动态SQL(ASE12.0+)
  • 下一篇教程: Sybase TraceFlag 定义
  •  

    关于本站 | 广告联系 | 版权声明 | 使用帮助

    Copyright © 2004-2008 www.egunao.com All rights reserved.