Home > Database > Mysql Tutorial > 项目进行中的小问题-0418

项目进行中的小问题-0418

PHP中文网
Release: 2016-06-07 17:44:17
Original
1067 people have browsed it

今天又碰到了新问题,其实主要是忘记了具体的语法。 1、使用T-SQL语句来创建触发器 基本语句为﹕ create trigger trigger_name on {table_name | view_name} {for | After | Instead of }[ insert, update,delete ] as sql_statement 顺便补充一下关于触发器


今天又碰到了新问题,香港服务器租用,香港虚拟主机,香港服务器,其实主要是忘记了具体的语法。

1、使用T-SQL语句来创建触发器

基本语句为﹕       
  

create trigger trigger_name
  on {table_name | view_name}
  {for | After | Instead of } [ insert, update,delete ]
  as
    sql_statement
Copy after login

顺便补充一下关于触发器的其他语句

删除触发器:

  

drop trigger trigger_name
Copy after login

修改触发器:

  

alter trigger trigger_name
  on {table_name | view_name}
  {for | After | Instead of }
   [ insert, update,delete ]
  as
Copy after login

    sql_statement

查看数据库已有触发器:

  

use jxcSoftware go select * from sysobjects where xtype='TR'
Copy after login

查看单个触发器 :

  exec sp_helptext '触发器名'

2、参数化的sql语句中,like 和 in 的正确用法

 

 string sql=" select * from tableA where FieldA like '%' + @FieldA +'%' ";
  string sql="exec('select * from tableA where FieldB in (' + @FieldB +')') ";
Copy after login

 

 以上就是 项目进行中的小问题-0418的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template