易截截图软件、单文件、免安装、纯绿色、仅160KB

Sql Server Check约束 - MS-SQL Server / 基础类

表名:tb_star

字段:star_id   int
   star_name varchar(50)



写一个Check约束:要求star_name必须包含andy或jay   
建table ?
SQL code:
create table tb_star(

star_id int,
star_name varchar(50),
CONSTRAINT check_name CHECK (charindex('andy',star_name)>0 or charindex('jay',star_name)>0 )
)


SQL code:
create table tb_star(star_id int,star_name varchar(50) check(star_name like '%andy%' or star_name like '%jay%'))


SQL code:

--加check
Alter table tb_star add CONSTRAINT check_name CHECK (charindex('andy',star_name)>0 or charindex('jay',star_name)>0 )




SQL code:

CREATE TABLE tb_star(
star_id int NOT NULL,
star_name varchar(50) NOT NULL,
CONSTRAINT PK_tb_star PRIMARY KEY CLUSTERED(star_id),
CONSTRAINT CK_tb_star_star_name CHECK(star_name LIKE '%andy%' OR star_name LIKE '%jay%')
)



create table tb_star(

 star_id int,
 star_name varchar(50),


相关问答:

jsp链接sql2000的疑问?



type Exception report


message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jas ......

求一SQL - MS-SQL Server / 基础类

tab1 字段:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 字段:goodsid,goodskind(商品类型)
tab3 字段:goodskind(商品类型),kindname
结果:
得到商品类型在一段时间 ......

sql 问题 - MS-SQL Server / 基础类

需求如下:
学院 academy(aid,aname)
班级 class(cid,cname,aid)
学生 stu(sid,sname,aid,cid)
住宿区 region(rid,rname)
宿舍楼 build(bid,rid,bnote) bnote是‘男’/‘女’
宿舍 dorm(did,rid,bid,bedn ......

一条 SQL - Oracle / 基础和管理

有这样一条SQL
 Select Get_Costtaxrate(col1), Get_Tcostvalue(col1) from a
 
其中Get_Costtaxrate、Get_Tcostvalue都是函数,这两个函数里面都是查找一个大表,Get_Tcostvalue还需要调用Get_C ......

sql语句问题 - MS-SQL Server / 疑难问题

现在有一个部门表dept(部门名称,部门号。。)有一个人员表emp(姓名,人员编号,职位,薪资,部门)
emp表中的内容是这样的:
a 1 工程师 3000 软件部
b 2 普通员工 2000 硬件部
c 3 工程师 4000 硬件部
d ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号